import math def check_line(line, start, square_size, current_count): dict = {'X': 0, 'O': 0} for j in range(start, start + current_count): dict[line[j]] += 1 smaller_square = (square_size - 2) * (square_size - 2) if dict['X'] == smaller_square or dict['O'] == smaller_square: return True return False def some_func(line, line_size): count = 0 for i in range(3, math.floor(math.sqrt(line_size)) + 1): i_sqr = i * i for line_start in range(line_size - i_sqr + 1): res = check_line(line, line_start, i, i_sqr) if res: count += 1 return count if __name__ == '__main__': count = int(input()) line = input() res = some_func(line, count) print(res)