Problem:
 Score : 200 points    Problem Statement We have a string S of length N consisting of uppercase English letters.  How many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?      Constraints  3 \leq N \leq 50  S consists of uppercase English letters.         Input Input is given from Standard Input in the following format:  N  S       Output Print number of occurrences of ABC in S as contiguous subsequences.        Sample Input 1 10
ZABCDBABCQ      Sample Output 1 2  Two contiguous subsequences of S are equal to ABC : the 2 -nd through 4 -th characters, and the 7 -th through 9 -th characters.       Sample Input 2 19
THREEONEFOURONEFIVE      Sample Output 2 0  No contiguous subsequences of S are equal to ABC .       Sample Input 3 33
ABCCABCBABCCABACBCBBABCBCBCBCABCB      Sample Output 3 5

Solution (Python):
import re

N=int(input())
S=input()

ans=len(re.findall('ABC',S))
print(ans)

Solution (Python):
n = int(input())
s = input()
s = s[:n]
count = s.count("ABC")
print(count)

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

Solution (Python):

N = int(input())
S = str(input())

target = "ABC"

val = S.count(target)
print(val)

Solution (Python):
N=input()
N=input()
S="ABC"

count=0
ds = len(S)
ind = N.find(S)
while len(N) > 1 and ind>=0:
    N = N[ind+ds:]
    
    ind = N.find(S)
    count += 1

print(count)

Solution (Python):
n=int(input())
s=input()
g=0
for c in range(n-2):
    if s[c:c+3]=="ABC":
        g+=1
print(g)

Solution (Python):
N=int(input())
S=input()
c=0
for i in range(N-2):
  if S[i:i+3]=="ABC":
    c+=1
print(c)

Solution (Python):
def main():
    N = int(input())
    S = input()
    print(S.count('ABC'))

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
S = input()
c = 0 
for i in range(N - 2): 
        if S[i:i + 3] == "ABC":
                c += 1
        else:
                continue
print(c)

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(n-2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        count += 1
print(count)

Solution (Python):
N = int(input())
S = input()

print(S.count('ABC'))

Solution (Python):
n = int(input())
s = input()

i = 0
ans = 0
while i < n-2:
	if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
		ans += 1
		i += 3
	else:
		i += 1


print(ans)

Solution (Python):
n = int(input().rstrip())
s = input().rstrip()
num = s.count('ABC')
print(num)

Solution (Python):
n=int(input())
s=input()
print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):
N = int(input())
S = input()


print(S.count('ABC'))

Solution (Python):
N = int(input())
S = list(input())
ans = 0
for i in range(len(S) - 2):
    if ("".join(S[i:i+3]) == 'ABC'):
        ans += 1
print(ans)

Solution (Python):
N = int(input())
S = input()
print(S.count("ABC"))

Solution (Python):
n=int(input())
word=str(input())
print(word.count("ABC"))

Solution (Python):

"""
Created on Fri Jan 10 21:04:16 2020

@author: masat
"""

N = int(input())
S = input()

counter = 0
for i in range(N):
    if S[i:i+3] == "ABC":
        counter += 1
    else:
        pass

print(counter)

Solution (Python):
N = int(input())
S = input()
key = "ABC"
ans = 0
for i in range(len(S)):
    if key == S[i:i+3]:
        ans += 1
print(ans)

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(n-2):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(n - 2):
  if s[i:i+3] == 'ABC':
    count += 1
print(count)

Solution (Python):
N = int(input())
S = str(input())

print(S.count('ABC'))

Solution (Python):
input()
print(input().count("ABC"))

Solution (Python):
N = int(input())
S = input()

import re

n = re.findall('ABC', S)
print(len(n))

Solution (Python):
n = int(input())
s = input()
print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):


def main():
    n = int(input())
    s = input()

    count = sum(int(s[i:i + 3] == "ABC") for i in range(n - 2))
    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
s=input()
count=0
for i in range(n-2):
  if s[i:i+3]=='ABC':
    count+=1
print(count)

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    _ = int(input())
    S = input()

    print(S.count('ABC'))


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
S = input()

num = S.count('ABC')

print(num)

Solution (Python):
n=int(input())
s=input().split("ABC")
l=len(s)-1
print(str(l))

Solution (Python):
n=int(input()) 
S= input()
ans=S.count("ABC")
print(ans)

Solution (Python):
n = int(input())
s = str(input())

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

Solution (Python):
n = input()
s = input()
print(s.count("ABC"))

Solution (Python):
N = int(input())
S = input()

print(S.count("ABC"))

Solution (Python):
import re

n = int(input())
s = input()
print(len(re.findall('ABC', s)))

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(len(s)-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
print(ans)

Solution (Python):
N = input() 
S = input()
print(S.count("ABC"))

Solution (Python):
n=int(input())
s=input()
count=0
for i in range(n):
	if s[i:i+3]=='ABC':
		count+=1
print(count)

Solution (Python):
n = int(input())
s = input()
count = 0

for i in range(n-2):
  if s[i]+s[i+1]+s[i+2] == 'ABC':
    count +=1
print(count)

Solution (Python):
n = int(input())
s = input()

print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()
ts = s.replace('ABC','')
lts = len(ts)
print((n-lts)//3)

Solution (Python):

N = int(input())
S = input()

cnt = 0

for i in range(N-2):
    if S[i:i+3] == "ABC":
        cnt += 1

print(cnt)

Solution (Python):


N = int(input())
S = input()

print(str(S.count("ABC")))

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

Solution (Python):
N=int(input())
S=input()
print(S.count("ABC"))

Solution (Python):
n = int(input())
str = input()
ans = 0


for i in range(n):
  if str[i:i+3] == "ABC":
    ans = ans + 1
print(ans)

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):

n = int(input())
s = input()

print(s.count('ABC'))

Solution (Python):
N = int(input())
S = input()

ans = 0
for i in range(0,N-2):
  if S[i:i+3]=='ABC':
    ans += 1
    
print(ans)

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):
n = int(input())
s = list(input())
ans = 0

for i in range(n - 2):
    if s[i] + s[i + 1] + s[i + 2] == "ABC":
        ans += 1

print(ans)

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
ans = 0

for i in range(N - 2):
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        ans += 1

print(ans)

Solution (Python):

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

Solution (Python):

N = int(input())
S = input()

count = 0
condt = ''

for i in range(N-2):
    if S[i:i+3]=='ABC':
        count += 1
print(count)

Solution (Python):
import re

N = int(input())
S = input()
print(len(re.findall("ABC", S)))

Solution (Python):
N = int(input())
S = input()

import re

pattern = "ABC"

item = re.findall(pattern, S)

print(len(item))

Solution (Python):
n = int(input())
s = str(input())
count = 0
for i in range(n-2):
    if(s[i] == "A" and s[i+1] == "B" and s[i+2] == "C"):
        count += 1
print(count)

Solution (Python):


n = int(input())
s = input()

print(s.count('ABC'))

Solution (Python):
N = int(input())
S = input()
 
cnt = 0
for i in range(N-2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                cnt += 1
 
print(cnt)

Solution (Python):


n = int(input())
s = str(input())

print(s.count('ABC'))

Solution (Python):
n = int(input())
s = list(input())
i = 0
res = 0
while i < n:
    if ''.join(s[i: i+3]) == 'ABC':
        res += 1
        i += 3
    else:
        i += 1
print(res)

Solution (Python):
N = int(input())
S = input()
count=0
for i in range(N - 2):
	if S[i:i+3] == "ABC":
		count+=1
print(count)

Solution (Python):
N = int(input())
S = input()

print(S.count('ABC'))

Solution (Python):
n = int(input())
s = input()

print(s.count('ABC'))

Solution (Python):
import re
pattern = re.compile(r'ABC')

n = int(input())
m = pattern.findall(input())
print(len(m))

Solution (Python):


n = int(input())
s = input()

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

Solution (Python):
N = int(input())
S = input()

ans = 0
i=0
while i < len(S)-2:
    if S[i:i+3] == 'ABC':
        ans += 1
    i += 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n-2):
        if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):
str_len = int(input())
string = input()
pattern = "ABC"
res = 0
for i in range(str_len - 2):
    portion = string[i: i + 3]
    if portion == pattern:
        res += 1
print(res)

Solution (Python):
n = int(input())
s = input()
x = 0
for i in range(len(s)):
    if s[i:i+3] == 'ABC':
        x += 1
print(x)

Solution (Python):
n = int(input())
s = str(input())

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

Solution (Python):
n = int(input())
s = input()

cnt = 0
for i in range(n-2):
  c = s[i:i+3]
  if c == 'ABC':
    cnt += 1
print(cnt)

Solution (Python):
N = int(input())
S = input()

print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input()

ans = 0
for i in range(n-2):
    if s[i:i+3] == "ABC":
        ans += 1

print(ans)

Solution (Python):
N = int(input())
S = input()
count = 0

for i in range(N-2):
    if S[i]=='A' and S[i+1] == 'B' and S[i+2] == 'C':
        count = count + 1

print(count)

Solution (Python):
N = int(input())
S = input()
cnt=0
for i in range(N-2):
	if(S[i]=="A" and S[i+1]=="B" and S[i+2]=="C"):
		cnt+=1
print(cnt)

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

Solution (Python):
_ = input()
s = input()

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

Solution (Python):
N = int(input())
S = input()

ans = 0

for i in range(0, N):
    if len(S[i:i+3]) < 3:
        break

    if S[i:i+3] == "ABC":
        ans += 1

print(ans)

Solution (Python):
N=int(input())
S=input()
print(S.count('ABC'))

Solution (Python):
N = int(input())
S = input()

count = 0
for i in range(N-2):
    if "ABC" == S[i:i+3]:
        count += 1

print(count)

Solution (Python):
N = int(input())
S = input()

count = 0
for i in range(N-2):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        count += 1
print(count)

Solution (Python):
n = int(input())
s = input()

index_no = [i for i,x in enumerate(s) if x == "A"]

ans = 0
for j in index_no:
    if "ABC" == s[j:j+3]:
        ans += 1

print(ans)

Solution (Python):
N=int(input())
A=input()

i=0
ans=0
while(True):
  if i>N-3:
    break
  if A[i]=='A' and A[i+1]=='B' and A[i+2]=='C':
    ans+=1
    i+=3
  else:
    i+=1
print(ans)

Solution (Python):
N = int(input())
S = input();

i = 0
cnt = 0
while i < len(S)-2:
    if S[i:i+3] == 'ABC':
        cnt += 1
        i += 3
        continue
    i += 1



print(cnt)

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()
a = 0
for i in range(n-2):
  if s[i:i+3] == 'ABC':
    a += 1
    
print(a)

Solution (Python):
a=input()
b=input()
print(b.count('ABC'))

Solution (Python):
N = input()
S = input()
print(S.count('ABC'))

Solution (Python):
if __name__ == '__main__':
    a = int(input())
    s = input()


    print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()

ans = 0

for i in range(n-2):
  if s[i+2]=="C" and s[i+1]=="B" and s[i]=="A":
    ans += 1


print(ans)

Solution (Python):
n=int(input())

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

Solution (Python):
import sys; readline = sys.stdin.readline
from collections import deque

N = int(readline())
S = readline().rstrip()

count = 0

for i in range(N - 2):
    if S[i:i+3] == 'ABC':
        count += 1

print(count)

Solution (Python):
n = int(input())
s = input()

ans = 0
for i in range(n-2):
  if s[i] == 'A':
    if s[i+1] == 'B':
      if s[i+2] == 'C':
        ans += 1

print(ans)

Solution (Python):
n = int(input())
s = input()


print(s.count('ABC'))

Solution (Python):
n, s = int(input()), input()
print(s.count("ABC"))

Solution (Python):
n=int(input())
s=input()
cnt=0
for i in range(n-2):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        cnt+=1
print(cnt)

Solution (Python):
a = raw_input()
s = raw_input()

c = len(s.split('ABC')) -1
print(c)

Solution (Python):
N = int(input())
S = input()

print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):
n = int(input())
s = list(input())
cnt=0
for i in range(n-2):
    if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
        cnt+=1

print(cnt)

Solution (Python):
N = int(input())
S = input()
ans = 0

for i in range(N-2):
    if (S[i] + S[i+1] + S[i+2]) == "ABC":
        ans += 1

print(ans)

Solution (Python):
n = int(input())
s = input()

i = 0
cnt = 0
while i+2 < n:
    if 'ABC' == s[i:i+3]:
        cnt += 1
    i += 1
print(cnt)

Solution (Python):
N = int(input())
S = input()
S = list(S)
count = 0
for i in range(N-2):
    if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C":
        count += 1

print(count)

Solution (Python):
N = int(input())
S = input()

count = 0
for i in range(N-2):
        if S[i:i+3] == "ABC":
                count += 1

print(count)

Solution (Python):
n = int(input())
s = input()

count = 0

for i in range(n-2):
  if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
    count += 1

print(count)

Solution (Python):
n = input()
s = input()

t = 0
r = 0

while t != -1:
  t = s.find("ABC")
  if t != -1:
    r = r + 1
    s = s[(t+1):]
  else:
    break

print(r)

Solution (Python):
N = int(input())
S = input()

M = S.count('ABC')

print(M)

Solution (Python):
N = int(input())
S = input()

S += "   "
ans = 0

for ptr in range(N):
    if S[ptr:ptr + 3] == 'ABC':
        ans += 1

print(str(ans))

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(n-2):
    if s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C':
        count += 1

print(count)

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(n):
    if s[i] == 'A' and i+2 < n:
        if s[i:i+3] == 'ABC':
            count += 1
print(count)

Solution (Python):
n=int(input())
s=input()
print(s.count('ABC'))

Solution (Python):
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): 
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): 
    return a/gcd(a,b)*b

def divisors(a): 
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): 
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): 
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): 
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n-2):
        if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()

Solution (Python):
num = int(input())
let = input()

print(let.count('ABC'))

Solution (Python):
N=input()
S=input()
count=0
for i in range(len(S)-2):
    if S[i]=='A':
        if S[i+1]=='B':
            if S[i+2]=='C':
                count+=1
print(count)

Solution (Python):
N = int(input())
S = str(input())
print(S.count("ABC"))

Solution (Python):
N = int(input())
S = input()

ans = 0
for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                ans += 1

print(ans)

Solution (Python):
n=int(input())
s=list(input())
cnt=0
for i in range(n-2):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    cnt += 1
print(cnt)

Solution (Python):
def main():
    N = int(input())
    S = input()
    count = 0
    for i in range(N - 2):
        if S[i:i + 3] == 'ABC':
            count += 1
    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
S = input()

flag = 0
count = 0

for i in S:
  if i == "A":
    flag = 1
  elif i == "B" and flag == 1:
    flag = 2
  elif i == "C" and flag == 2:
    flag = 0
    count += 1
  else:
    flag = 0
print(count)

Solution (Python):
N = int(input())
X = input()

count = 0
for i in range(N-2):
    if X[i] == "A" and X[i+1] == "B" and X[i+2] == "C":
        count += 1
print(count)

Solution (Python):
N = int(input())
S = input()
ans = 0
for i in range(0,N-2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                ans += 1
print(ans)

Solution (Python):
def f(S):
    t=0
    N=len(S)
    for i in range(N-2):
        if S[i:i+3]=="ABC":
            t+=1
    return t
N=int(input())
S=input()
print(f(S))

Solution (Python):
N = int(input())
S = input()
print(S.count('ABC'))

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

Solution (Python):
N = int(input())
S = input()

cnt = 0
for i in range(N-2):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        cnt += 1

print(cnt)

Solution (Python):
N = int(input())
S = input()

ans = 0
for i in range(N - 2):
    if S[i : i + 3] == "ABC":
        ans += 1
print(ans)

Solution (Python):
N = input()
S = input()

print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input()

print(int((n - len(s.replace("ABC", "")))/3))

Solution (Python):
n=input()
s=input()
s.split()

print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()

count = 0
for i in range(len(s)-2):
    if s[i:i+3] == 'ABC':
        count += 1

print(count)

Solution (Python):
N = int(input())
S = str(input())

count = 0
for i in range(N-2):
    word = S[i:i+3]
    if word == 'ABC':
        count += 1

print(count)

Solution (Python):
N = int(input())
S = input()
print(S.count('ABC'))

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
S = input().rstrip()

n = len(S.split('ABC'))-1
print(n)

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()

ans = 0
for i in range(n-2):
    if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
        ans += 1

print(ans)

Solution (Python):
N=int(input())
S=input()
print(S.count("ABC"))

Solution (Python):
N = int(input())
S = list(input())
count = 0
for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B" and S[i+2] == "C":
            count += 1
print(count)

Solution (Python):
N = int(input())
S = input()
count = 0
for i in range(0, N - 2):
  if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
    count += 1
print(count)

Solution (Python):
n = input()
s = input()
print(s.count("ABC"))

Solution (Python):
N=int(input())
S=input()
count=0
for n in range(N-3+1):
    s=S[n:n+3]
    if s=='ABC':
        count+=1
print(count)

Solution (Python):
l = int(input())
s = input()
print(s.count('ABC'))

Solution (Python):
def main():
    n=int(input())
    s=input()
    print(sum(1 for i in range(max(0,n-2)) if s[i:i+3] == 'ABC'))

main()

Solution (Python):
n=int(input())
s=input()
cnt=0
while 'ABC' in s:
	s=s.replace('ABC','',1)
	cnt+=1
print(cnt)

Solution (Python):
n = int(input())
s = input()

count = 0
for i in range(n-2):
  if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
    count += 1
print(count)

Solution (Python):
n=int(input())
s=input()
print(sum(s[i:i+3]=="ABC" for i in range(n-2)))

Solution (Python):
n=int(input())
s=input()
count=0
str1=list(s)
for i in range(n-2):
    if (str1[i]=="A") & (str1[i+1]=="B") & (str1[i+2]=="C"):
        count+=1
        
print(count)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    S=input()+'XXX'
    ans=0
    for i in range(N):
        if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
S = input()

count = 0
for i in range(N-2):
    if S[i]+S[i+1]+S[i+2] == 'ABC':
        count += 1

print(count)

Solution (Python):
N=int(input())
S=input()
ans=0
for i in range(N-2):
  if "ABC"==S[i:i+3]:
    ans+=1
print(ans)

Solution (Python):
n = int(input())
s = input()
cnt = s.count('ABC')
print(cnt)

Solution (Python):
N = int(input())
S = input()
print(S.count("ABC"))

Solution (Python):
import re
a = int(input())
b = str(input())
d =re.findall("ABC",b)
print(len(d))

Solution (Python):
n=int(input())
s=input()

print(s.count("ABC"))

Solution (Python):
n = input()
s = input()
ans = 0
for i in range(len(s)-2):
    if s[i:i+3] == 'ABC':
        ans += 1
print(ans)

Solution (Python):
import re


def main():
    N = int(input())
    S = input()

    print((N - len(re.sub(r'ABC', "", S))) // 3)


main()

Solution (Python):
n = int(input())
s = input()

c = 0
for i in range(n-2):
  if s[i:i+3] == 'ABC':
    c += 1

print(c)

Solution (Python):
import re
N = input()
s=input()
print(len(re.findall("ABC",s)))

Solution (Python):
n = input()
s = input()

a = "ABC"

print(len(s.split(a))-1)

Solution (Python):
N=int(input())
s=input()
cnt=0
for i in range(0,N-2):
  if s[i]+s[i+1]+s[i+2]=="ABC":
    cnt+=1
print(cnt)

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

Solution (Python):
N = int(raw_input())
S = raw_input()

ans = 0

for i in range(N-2):
    if S[i:i+3] == "ABC":
        ans = ans + 1
print ans

Solution (Python):
N = int(input())
S = input()

List = list(S)
length = len(List)
cnt  = 0

for i in range(length):
  a = List[i]
  if a == "A" and i < length-2:
    if List[i+1] == "B" and List[i+2] == "C":
      cnt = cnt + 1
      
print(cnt)

Solution (Python):
import sys
ip = sys.stdin.readline

N = int(ip().rstrip())
S = ip().rstrip()
abc = 'ABC'
c = 0
for i in range(N-len(abc)+1):
    if S[i:i+len(abc)] == abc:
        c += 1
print(c)

Solution (Python):
n = int(input())
s = list(input(''))

ans = 0
for i in range(n-2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        ans += 1
print(ans)

Solution (Python):

N=int(input())
S=input()
ans=0
for i in range(N-2):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                ans=ans+1
print(ans)

Solution (Python):
N=int(input())
S=str(input())

print(S.count('ABC'))

Solution (Python):
n = int(input())
s = input()
lis = []
for l in range(n-2):
  lis.append(s[l:l+3])
print(lis.count("ABC"))

Solution (Python):
n = int(input())
table = list(input())
cnt = 0
for x in range(n - 2):
    if table[x] == 'A' and table[x + 1] == 'B' and table[x + 2] == 'C':
        cnt += 1
print(cnt)

Solution (Python):
N = int(input())
S = list(input())
result = 0
for i in range(N-2):
    if S[i] != 'A':
        continue
    else:
        if S[i+1]=='B' and S[i+2]=='C':
            result += 1
print(result)

Solution (Python):
n = input()
s = input()
print(s.count("ABC"))

Solution (Python):
import re
exp = re.compile("ABC")

n = input()
s = input()

res = exp.findall(s)

print(len(res))

Solution (Python):
N = int(input())
S = input()
print(S.count("ABC"))

Solution (Python):
N = int(input())
S = input()
ans = 0
for i in range(N-2):
    if S[i:i+3] == "ABC":
        ans += 1
print(ans)

Solution (Python):
n=int(input())
s=input()
cnt=0
for i in range(len(s)-2):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    cnt+=1
print(cnt)

Solution (Python):

n = int(input())
s = input()
s = s[:n]
count = s.count("ABC")

print(count)

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

Solution (Python):
n=input()
s=input()

print(s.count("ABC"))

Solution (Python):
n = int(input())
s = input()

state  = 0
cn = 0

for i in s:
    if(i == "A"):
        state  = 1
    elif(i == "B"):
        if(state  == 1):
            state  = 2
        else:
            state = 0
    elif(i == "C"):
        if(state  == 2):
            cn += 1
        state = 0
    else:
        state = 0

print(cn)

Solution (Python):
N = int(input())
S = input()

print(S.count('ABC'))

Solution (Python):
n = int(input())
s = input()
print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(n-2) :
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                ans += 1
            else :
                pass
        else :
            pass
    else :
        pass
print(ans)

Solution (Python):
n = int(input())
s = input()
print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
print(ans)

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
import re
_ = input()
s = input()
print(len(re.findall('ABC', s)))

Solution (Python):
l = int(input())
s = str(input())

if len(s) != l:
    exit()

s = s.upper()

c = s.count('ABC')

print(c)

Solution (Python):
import sys

def main():
    N = int(input())
    S = input()

    ans = 0
    for i in range(0, N-2):
        if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
            ans += 1

    print(ans)

main()

Solution (Python):
def main():
    n=int(input())
    a=input()
    flag=0
    cnt=0
    for i in range(n):
        if flag==0:
            if a[i]=="A":
                flag=1
            else:
                pass
        elif flag==1:
            if a[i]=="B":
                flag=2
            else:
                if a[i]=="A":
                    flag=1
                else:
                    flag=0
        elif flag==2:
            if a[i]=="C":
                flag=0
                cnt+=1
            else:
                if a[i]=="A":
                    flag=1
                else:
                    flag=0
    print(cnt)
main()

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
N = int(input())
S = str(input())

print(len(S.split('ABC'))-1)

Solution (Python):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines








def main():
	n=int(input())
	s=input().rstrip().decode('utf-8')
	
	ans=0
	
	for i in range(n-2):
		if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
			ans+=1
	
	
	
	print(ans)
	
	
	
	
if __name__ == "__main__":
	main()

Solution (Python):
N = int(input())
S = input()
print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
N = int(input())
S = str(input())

a = S.count('ABC')

print(a)

Solution (Python):
N = int(input())
S = input()

counter = 0
for i in range(N):
  s = S[i:i+3]
  if s == "ABC":
    counter += 1
print(counter)

Solution (Python):
a = input()
b = str(input())

print(b.count('ABC'))

Solution (Python):
n=int(input())
s=input()
cnt=0
for i in range(n-2):
  if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
    cnt+=1
print(cnt)

Solution (Python):
n = int(input())
l = list(input())
count = 0
for i in range(n-2):
    if l[i]=="A":
        if l[i+1]=="B":
            if l[i+2]=="C":
                count += 1
print(count)

Solution (Python):
input()
print(input().count('ABC'))

Solution (Python):
N = int(input())
S = input()
print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input()

print(s.count("ABC"))

Solution (Python):
N = int(input())
S = input()

ans = 0

for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                ans += 1

print(ans)

Solution (Python):
N = int(input()) 
S = input()

A = (S.count("ABC"))
print(A)

Solution (Python):


N = int(input().split()[0])
s = input()
c = 0

for i, ch in enumerate(s):
    if i + 3 > len(s):
        break

    sub = s[i : i + 3]
    if sub == "ABC":
        c += 1
ans = c
print(ans)

Solution (Python):
N=int(input())
S=input()
count=0
for i in range(N-2):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        count+=1
print(count)

Solution (Python):
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    N = sc.intarr()[0]
    S = sc.strarr()[0]

    count = 0
    flag = 0
    for i in range(N):
        if S[i] == "A":
            flag = 1
        elif flag == 1 and S[i] == "B":
            flag = 2
        elif flag == 2 and S[i] == "C":
            count = count + 1
            flag = 0
        else:
            flag = 0

    print(count)


def dfs(N):
    global dp
    if N <= 0:
        return 1

    if dp[N] > -1:
        return dp[N]
    ans = 0
    for i in range(1, 7):
        ans += dfs(N-i)
    dp[N] = ans
    return ans


class Scan():

    def intarr(self):
        num_array = list(map(int, input().split()))
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


def gcd(a, b):  
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):  
    return a * b // gcd(a, b)


main()

Solution (Python):
n = int(input())
s = input()

ans = 0
for i in range(n-2):
    if s[i:i+3] == "ABC":
        ans += 1

print(ans)