import math
import sys

if __name__ == '__main__':
    N = int(input())
    file = sys.stdin.readline().strip("\n")
    res = 0
    for start in range(N):
        blue = red = 0
        for end in range(start, N):
            if file[end] == "X":
                red += 1
            else:
                blue += 1
            length = end - start + 1
            if length > 8 and math.sqrt(length)**2 == length:
                if (blue == 4 * (math.sqrt(length) - 1) and red == length - 4 * (math.sqrt(length) - 1) or (red == 4 * (math.sqrt(length) - 1) and blue == length - 4 * (math.sqrt(length) - 1))):
                    res += 1
                # print(length, blue, red, file[start:end + 1])
            # file[start:end + 1]
            # print(file[start:end + 1], end - start + 1)
    print(res)