n = int(eval(input()))

s = eval(input())

cnt = 0

for i in range(n-2):

    if s[i:i+3] == 'ABC':

        cnt += 1

print(cnt)

_ = eval(input())

print((input().count('ABC')))

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

_ = eval(input())
print((input().count("ABC")))

-n = int(eval(input())) -s = eval(input()) -cnt = 0 -for i in range(n - 2): -    if s[i : i + 3] == "ABC": -        cnt += 1 -print(cnt) +_ = eval(input()) +print((input().count("ABC")))