import math # Press the green button in the gutter to run the script. if __name__ == '__main__': size = input() size = int(size) input = input() prvky = [] result = 0 for char in input: prvky.append(char) x = 1 while size > (x+2)**2: x += 1 for i in range(1, x+1): celkovy_size = (i+2)**2 for j in range(0, size, i): operacni_mnozina = prvky[j:celkovy_size+1] modre = operacni_mnozina.count('X') cervene = operacni_mnozina.count('O') if modre > cervene: if cervene >= i**2 and modre >= (celkovy_size-(i**2)): result += 1 else: if modre >= i**2 and cervene >= (celkovy_size-(i**2)): result += 1 print(result)