Everybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!

Yesterday one student, Vasya and his mates made some barbecue and they drank this healthy drink only. After they ran out of the first barrel of juice, they decided to play a simple game. All n people who came to the barbecue sat in a circle (thus each person received a unique index b_{i} from 0 to n - 1). The person number 0 started the game (this time it was Vasya). All turns in the game were numbered by integers starting from 1. If the j-th turn was made by the person with index b_{i}, then this person acted like that:  he pointed at the person with index (b_{i} + 1) mod n either with an elbow or with a nod (x mod y is the remainder after dividing x by y);  if j ≥ 4 and the players who had turns number j - 1, j - 2, j - 3, made during their turns the same moves as player b_{i} on the current turn, then he had drunk a glass of juice;  the turn went to person number (b_{i} + 1) mod n. 

The person who was pointed on the last turn did not make any actions.

The problem was, Vasya's drunk too much juice and can't remember the goal of the game. However, Vasya's got the recorded sequence of all the participants' actions (including himself). Now Vasya wants to find out the maximum amount of juice he could drink if he played optimally well (the other players' actions do not change). Help him.

You can assume that in any scenario, there is enough juice for everybody.


-----Input-----

The first line contains a single integer n (4 ≤ n ≤ 2000) — the number of participants in the game. The second line describes the actual game: the i-th character of this line equals 'a', if the participant who moved i-th pointed at the next person with his elbow, and 'b', if the participant pointed with a nod. The game continued for at least 1 and at most 2000 turns. 


-----Output-----

Print a single integer — the number of glasses of juice Vasya could have drunk if he had played optimally well.


-----Examples-----
Input
4
abbba

Output
1

Input
4
abbab

Output
0



-----Note-----

In both samples Vasya has got two turns — 1 and 5. In the first sample, Vasya could have drunk a glass of juice during the fifth turn if he had pointed at the next person with a nod. In this case, the sequence of moves would look like "abbbb". In the second sample Vasya wouldn't drink a single glass of juice as the moves performed during turns 3 and 4 are different.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = int(input())
s = str(input())
while (len(s) - 1) % n != 0:
	s = s[:len(s) - 1]
sol = 0
for i in range(len(s) - 1, 3, -n):
	if s[i - 1] == s[i - 2] and s[i - 2] == s[i - 3]:
		sol += 1
print(sol)


n = int(input())
s = input()
res = 0
for i in range(0, len(s), n):
	if i >= 4 and s[i - 1] == s[i - 2] == s[i - 3]:
		res += 1
print(res)


n = int(input())
s = list(input())
d = 0
for i in range(len(s)):
	if i % n == 0:
		if i >= 4:
			if s[i - 3] == s[i - 2] == s[i - 1]:
				d += 1
print(d)


n = int(input())
s = input()
cnt = 0
for i in range(len(s))[n::n]:
	if s[i - 1] == s[i - 2] and s[i - 2] == s[i - 3]:
		cnt += 1
print(cnt)


n = int(input())
s = input()
t = 0
for x in range(n, len(s), n):
	if s[x - 1] == s[x - 2] == s[x - 3]:
		t += 1
print(t)


n = int(input())
s = str(input())
sl = len(s)
d = 0
for i in range(n, sl, n):
	if s[i - 1] == s[i - 2] and s[i - 1] == s[i - 3]:
		d += 1
print(d)


n = int(input())
s = input().strip()
pl = 0
ans = 0
for q in range(len(s)):
	if q >= 3 and pl == 0:
		if s[q - 3] == s[q - 2] == s[q - 1]:
			ans += 1
	pl = (pl + 1) % n
print(ans)


n = int(input())
str = input()
cnt = 0
length = len(str)
for i in range(n, length, n):
	if str[i - 1] == str[i - 2] and str[i - 2] == str[i - 3]:
		cnt += 1
print(cnt)


(s, n, t) = (0, int(input()), input())
print(sum((t[i] == t[i + 1] == t[i + 2] for i in range((3 // n + 1) * n - 3, len(t) - 3, n))))


n = int(input())
a = input()
sum = 0
for i in range(0, len(a), n):
	if i >= 4 and a[i - 1] == a[i - 2] == a[i - 3]:
		sum += 1
print(sum)


n = int(input())
moves = input()
turns_vasnja = int((len(moves) - 1) / n)
count = 0
for i in range(1, turns_vasnja + 1):
	if moves[n * i - 3] == moves[n * i - 2] == moves[n * i - 1]:
		count += 1
print(count)


n = int(input())
s = input()
(a, b) = (n, 0)
while a < len(s):
	if s[a - 3] == s[a - 2] == s[a - 1]:
		b += 1
	a += n
print(b)


n = int(input())
s = input()
nn = len(s)
ans = 0
for i in range(n, nn, n):
	if s[i - 1] + s[i - 2] + s[i - 3] == 'aaa' or s[i - 1] + s[i - 2] + s[i - 3] == 'bbb':
		ans += 1
print(ans)


3
n = int(input())
s = input()
print(len([1 for i in range(n, len(s), n) if len(set(list(s[i - 3:i]))) == 1]))


import sys
fin = sys.stdin
n = int(fin.readline())
b = fin.readline().strip()
m = len(b)
res = 0
for i in range(n, m, n):
	if b[i - 3] == b[i - 2] == b[i - 1]:
		res += 1
print(res)


def drink(s, n):
	(j, res) = (n, 0)
	while j < len(s):
		if s[j - 1] == s[j - 2] and s[j - 2] == s[j - 3]:
			res += 1
		j += n
	return res
m = int(input())
t = input()
print(drink(t, m))


n = input('')
n = int(n)
str = input('')
l = len(str)
count = 0
if l <= 4:
	print(0)
elif l > 4:
	c = n
	while c <= l - 1:
		str1 = str[c - 3:c]
		if str1 == 'aaa' or str1 == 'bbb':
			count += 1
		c += n
	print(count)


n = int(input())
s = input()
ans = 0
for i in range(1, (len(s) - 1) // n + 1):
	ans += int(s[n * i - 3:n * i] in ('aaa', 'bbb'))
print(ans)


I = input
n = int(I())
s = I()
print(sum((2 > len(set(s[i - 3:i])) for i in range(n, len(s), n))))


n = int(input())
s = input()
i = n
ans = 0
while i < len(s):
	if s[i - 1] == s[i - 2] and s[i - 2] == s[i - 3]:
		ans += 1
	i += n
print(ans)


n = int(input())
moves = input()
i = n
count = 0
while i < len(moves):
	m = moves[i - 1]
	if m == moves[i - 2] and m == moves[i - 3] and (m == moves[i - 3]):
		count += 1
	i += n
print(count)


n = int(input())
s = input()
k = len(s)
i = 0
c = 0
while i < k:
	if i - 3 >= 0:
		if s[i - 1] == s[i - 2]:
			if s[i - 2] == s[i - 3]:
				c += 1
	i += n
print(c)


n = int(input().strip())
ans = 0
s = input().strip()
for i in range(n, len(s), n):
	if s[i - 1] == s[i - 2] == s[i - 3]:
		ans += 1
print(ans)


def main():
	n = int(input())
	s = input()
	print(0 if n < 4 else sum((s[i:i + 4] in ('aaaa', 'aaab', 'bbba', 'bbbb') for i in range(n - 3, len(s), n))))
main()


(n, s) = (int(input()), input())
print(sum((1 for i in range(len(s)) if i > 0 and i % n == 0 and (s[i - 3:i] in ('aaa', 'bbb')))))


n = int(input())
s = input()
a = s[n - 3:-1:n]
b = s[n - 2:-1:n]
c = s[n - 1:-1:n]
print(sum((x == y == z for (x, y, z) in zip(a, b, c))))


n = int(input())
actions = input()
glasses = 0
for i in range(n, len(actions), n):
	if actions[i - 1] == actions[i - 2] == actions[i - 3]:
		glasses += 1
print(glasses)


import math

class CodeforcesTask332ASolution:

	def __init__(self):
		self.result = ''
		self.players = 0
		self.game = ''

	def read_input(self):
		self.players = int(input())
		self.game = [x for x in input()]

	def process_task(self):
		for x in range(len(self.game) // self.players + int(math.ceil(len(self.game) % self.players / self.players))):
			self.game[x * self.players] = '_'
		game = ''.join(self.game)
		self.result = str(game.count('bbb_') + game.count('aaa_'))

	def get_result(self):
		return self.result
Solution = CodeforcesTask332ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
s = input()
i = n
l = len(s)
tot = 0
while i < len(s):
	if s[i - 1] == s[i - 2] == s[i - 3]:
		tot += 1
	i += n
print(tot)


n = int(input())
s = input()
i = n
count = 0
while i < len(s):
	if s[i - 1] == s[i - 2] == s[i - 3]:
		count += 1
	i += n
print(count)


(n, s, ans) = (int(input()), input(), 0)
for i in range(len(s)):
	if i > 2 and (not i % n) and (s[i - 1] == s[i - 2] == s[i - 3]):
		ans += 1
print(ans)


n = int(input())
s = input()
c = 0
for i in range(n, len(s), n):
	tmp = s[i - 3:i]
	if 'a' in tmp and 'b' in tmp:
		continue
	c += 1
print(c)


n = int(input())
g = input()
r = 0
for i in range(n, len(g), n):
	if g[i - 1] == g[i - 2] == g[i - 3]:
		r += 1
print(r)


a = int(input())
b = input()
print(sum((b[i - 1] == b[i - 2] == b[i - 3] for i in range(a, len(b), a))))


n = int(input())
f = input()
list(f)
out = 0
for i in range(n, len(f), n):
	if f[i - 1] == f[i - 2] and f[i - 2] == f[i - 3]:
		out = out + 1
print(out)


n = int(input())
string = input()
count = 0
i = n
while i < len(string):
	flag = False
	if string[i - 1] == string[i - 2] and string[i - 2] == string[i - 3] and (i >= 3):
		flag = True
	if flag:
		count += 1
	i += n
print(count)


(s, n, t) = (0, int(input()), input())
print(sum((t[i - 3:i] in ['aaa', 'bbb'] for i in range((3 // n + 1) * n, len(t), n))))


n = int(input())
s = input()
l = len(s)
if l < 4:
	print(0)
elif l == 4:
	if n == 3:
		if s[0] == s[1] and s[1] == s[2]:
			print(1)
		else:
			print(0)
	else:
		print(0)
else:
	k = 0
	dr = 0
	while k + n < len(s):
		k += n
		if s[k - 1] == s[k - 2] and s[k - 2] == s[k - 3]:
			dr += 1
	print(dr)


n = int(input())
s = input()
c = 0
for i in range(n, len(s), n):
	if s[i - 1] + s[i - 2] + s[i - 3] in ['aaa', 'bbb']:
		c += 1
print(c)


n = int(input())
A = input()
if len(A) <= n:
	print(0)
else:
	p = A[n - 1] == A[n - 2] == A[n - 3]
	ans = 0
	for i in range(n, len(A), n):
		p = A[i - 1] == A[i - 2] == A[i - 3]
		if p:
			ans += 1
	print(ans)


n = int(input())
s = input().strip()
ans = 0
for i in range(n, len(s), n):
	ans += s[i - 3:i] == 'bbb' or s[i - 3:i] == 'aaa'
print(ans)