import math

l = int(input())
f = input()
res = 0

for flsqrt in range(3, int(math.sqrt(l)) +1):
	fl = flsqrt ** 2
	smallcount = (flsqrt - 2) ** 2
	bigcount = fl - smallcount
	xs = 0
	s = []
	i = 0
	for c in range(fl):
		s.append(f[c])
		if f[c] == 'X':
			xs += 1
	if (xs == smallcount and fl - xs == bigcount) or (xs == bigcount and fl - xs == smallcount):
		res += 1
	
	for c in range(fl, l):
		if f[c] != s[i]:
			if f[c] == 'X':
				xs += 1
			else:
				xs -= 1
			s[i] = f[c]
		
		if (xs == smallcount and fl - xs == bigcount) or (xs == bigcount and fl - xs == smallcount):
			res += 1
		i += 1
		if i == fl:
			i = 0
		
print(res)
