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):
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)

main()

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

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

while i < len(s):
    if not (s[i] == 'A'):
        i+=1
        continue

    i+=1
    if not i < len(s):
        break
    if not (s[i] == 'B'):
        continue

    i+=1
    if not i < len(s):
        break
    if not (s[i] == 'C'):
        continue

    i+=1
    count+=1

print(count)

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):
a = input()
b = input()
print(b.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):
x = int(input())
line = input()
s = 'ABC'
count = 0
for i in range(3, x+1):
    j = i - 3
    if line[j:i] == s:
        count += 1
print(count)

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

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

print(cnt)

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()
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()
result=0
for i in range(N):
  if S[i:i+3]=='ABC':
    result+=1
print(result)

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

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

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


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

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

    print(ans)


if __name__ == "__main__":
    main()

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

ans = S.count("ABC")

print(ans)

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

Solution (Python):
N = int(input())
S = list(input())
counter = 0

for i in range(1,N-1):
  if S[i-1]+S[i]+S[i+1] == "ABC":
    counter += 1
    
print(counter)

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):

import sys

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


def main():
    N = int(readline())
    S = readline().rstrip().decode()
    ans = 0
    for i in range(N - 2):
        if S[i:i+3] == 'ABC':
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

ans = 0

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

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

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

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

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()

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

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

print(S.count('ABC'))

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

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

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

print(cnt)

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

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

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):
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()
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(S.count("ABC"))

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

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

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


def main():
    N = int(input())
    S = input().strip()
    answer = 0
    assert N == len(S)
    for i in range(N-2):
        if S[i] == "A":
            if S[i+1] == "B" and S[i+2] == "C":
                answer += 1
    print(answer)


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):

def resolve():
    n=input()
    s=input()
    print(s.count("ABC"))
resolve()

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):
a = int(input())
s = input()
cnt = 0
i = 0
while i < a:
    if s[i:i+3] == 'ABC':
        cnt += 1
        i += 2
    i += 1
print(cnt)

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

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

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

print(s.count("ABC"))

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

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

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):

def splitlist(List, n=3):
    N = len(List)
    for i in range(N):
        yield List[i:i+n]

_ = int(input())
S = list(input())
S1 = list(splitlist(S))

import collections
print(S1.count(["A", "B", "C"]))

Solution (Python):
_ = input()
S = input()
a = 0
c = 0
for i in S:
    if i == 'A':
        c = 1
    elif i == 'B' and c == 1:
        c = 2
    elif i == 'C' and c == 2:
        c = 0
        a += 1
    else:
        c = 0
print(a)

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

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

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

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

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

S_rep=S.replace('ABC','')
print((N-len(S_rep))//3)

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:i+3] == 'ABC':
            ans += 1
        else:
            pass
    else:
        pass
print(ans)

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




s=list(input())
count=0
for i in range(n-2):
    if s[i:i+3]==["A","B","C"]:
        count+=1

print(count)

Solution (Python):
N = int(input())
S = str(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()
ans=0
for i,j,k in zip(s[0:],s[1:],s[2:]):
  if (i,j,k)==("A","B","C"):
    ans+=1
print(ans)

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 n in range(N-2):
    if S[n] == 'A' and S[n+1] == 'B' and S[n+2] == 'C':
        cnt += 1
print(cnt)

Solution (Python):
import collections

n = int(raw_input())
s = map(lambda x:ord(x) - ord('a'.upper()),list(raw_input()))

count,c = 0,0

for i in s:
	if i == c:
		c +=1
	else:
		c = 0
		if i == c: c +=1
	if c == 3:
		count +=1
		c = 0
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):
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):
n = int(input())
t = input()

print(t.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())
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):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
s = [_ for _ in input()]

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

print(cnt)

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 S[i: i+3] == 'ABC':
        count += 1
print(count)

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

res = 0

for i in range(len(s)):
    if(s[i:i+3] == "ABC"):
        res += 1
print(res)

Solution (Python):
N = int(input())
S = list(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 = list(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()
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 k in range(N-2):
  if S[k:k+3]=="ABC":
    count += 1
print(count)

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):
n = int(input())
s = str(input())

if "ABC" in s:
    print(s.count("ABC"))
else:
    print(0)

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

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()
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()
ans = 0
for i in range(N - 2):
    if S[i : i + 3] == 'ABC':
        ans += 1
print(ans)

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

_ = readline()
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" and s[i + 1] == "B" and s[i + 2] == "C"):
        cnt +=1
print(cnt)

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

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

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

result=0

for index, sss in enumerate(S):
    if S[index:index+3]=="ABC":
        result+=1

print(result)

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

result = 0

for n in range(N):
    if S[n:n+3] == "ABC" :
        result += 1

print(result)

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

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

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

print(len([0 for c1, c2, c3 in zip(S, S[1:], S[2:]) if c1 == 'A' and c2 == 'B' and c3 == 'C']))

Solution (Python):



N = int(input())
print(input().count("ABC"))

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

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

print(num)

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

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

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 = 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 = int(input())
S = input()

print(S.count("ABC"))

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()
ans=s.count("ABC")
print(ans)

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes,no): print(yes) if b else print(no)





n=n0()
s=s0()
print(s.count("ABC"))

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

Solution (Python):
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007

n = int(input())







s = input()









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

print(flag)

Solution (Python):
import re

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

print(len(re.findall('ABC',s)))

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

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

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

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

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
S=list(ns())
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())
w = input()

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

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

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

print(S.count("ABC"))

Solution (Python):
n=int(input())
s=input()
result=''
count=0 
for i in s:
    result+=i
    if result.endswith('ABC'):
        count+=1
print(count)

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

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()
result=s.count('ABC')
print(result)

Solution (Python):
N = int(input())
S = str(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=str(input())
print(s.count("ABC"))

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

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

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

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()
ct = 0
for i in range(2, n):
    if s[i-2] == 'A' and s[i-1] == 'B' and s[i] == 'C':
        ct += 1
print(ct)

Solution (Python):


a=int(input())

p=str(input())

  

print(p.count("ABC"))

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

Solution (Python):
N = 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=str(input())

count=0
i=0
ans=s.count("ABC")
  
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):
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
s=input()
print(s.count("ABC"))

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

c = 0
for i in range(0,len(S)-1):
  if S[i:i+3]==["A","B","C"]:
    c += 1

print(c)

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())
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()
count = 0
for i in range(n):
    if i>=2 and s[i-2]+s[i-1]+s[i] == 'ABC':
        count += 1
print(count)

Solution (Python):
N, S = open(0).read().rstrip().split('\n')
ans = 0
for i in range(int(N)-2):
    if S[i:i+3] == 'ABC':ans+=1
print(ans)

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

ans = 0
for i in range(0, n-2):
    if 'ABC' == 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:i + 3] == 'ABC':
        count += 1
print(count)

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


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

print(a)

Solution (Python):
import itertools
import math
import fractions
import functools
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()
print(S.count("ABC"))

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

print(s.replace("ABC", "x").count("x"))

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(S.count('ABC'))

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

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

s = list(s)
count = 0
if n >= 3:
    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):

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        
        if n % k == 0:
            return False
            
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  

'''

def factorial(x, mod=10**9+7):
    
    
    
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''











def main():

    steps=0
    state=0
    w=1
    j=0
    k=0
    n=int(input())
    s=input()
    ans=0
    a=[i for i in s]
    for i in range(len(s)-2):
        '''
        sを切り抜くやり方で可能だが今回はacを優先
        '''
        if a[i]=="A" and a[i+1]=="B" and a[i+2]=="C":
            ans +=1
    print(ans)
    
    




    
        
    
    

    
    
    
    
    DP = np.zeros(w+1, dtype=int)
    exdp=np.zeros((3,4)) 
    
    
    
        
        
    
    
        
        
    


    "1行1つの整数を入力を取得し、整数と取得する"
    
    
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    
    


    
    
    
    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]
    

    ls = ["a", "b", "c", "d", "e"]


    
    

    
    

    
    
    
    
    
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

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

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

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

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=count+1
                i=i+3
            else:
                i=i+2
        else:
            i=i+1
print(count)

Solution (Python):

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


cnt = 0
for i in [ind for ind, s in enumerate(S) if s == "A" and len(S[ind:]) >= 3]:
    if S[i:i + 3] == "ABC":
        cnt += 1

print(cnt)

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

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 = list(input())
ans = 0
for i in range(N-2):
  a = S[i] + S[i+1] + S[i+2]
  if a == "ABC":
    ans += 1
print(ans)

Solution (Python):
import sys
import math
import bisect


def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        if i + 3 <= n:
            if s[i:i+3] == 'ABC':
                ans += 1
    print(ans)

if __name__ == "__main__":
    main()

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

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

Solution (Python):

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

s = s.replace("ABC","")

print((n-len(s))//3)

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    s = list(input()[:-1])
    abc = list('ABC'.encode())
    ans = 0
    for i in range(n - 2):
        if s[i: i + 3] == abc:
            ans += 1
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

total = 0
for i in range(3, len(S) + 1):
    total += int(S[i-3:i] == 'ABC')

print(total)

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

    N = int(input())
    S = list(input().rsplit()[0])

    ans = 0
    for i in range(len(S)):
        s = "".join(S[i:i+3])
        if s == 'ABC':
            ans += 1
    print(ans)


if __name__ == "__main__":
    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)

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

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

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

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

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()
counter=0
for i in range(N-2):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        counter+=1
print(counter)

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

nums = s.count('ABC')

print(nums)

Solution (Python):

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

ans = 0

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

print(ans)

Solution (Python):
N = int(input())
S = input()
count = 0
for i in range(0,N-2,1):
    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):
N = int(input())
S = input()

print(S.count("ABC"))

Solution (Python):
import fileinput

n = input()
s = input()

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

print(c)

Solution (Python):
N = int(input())
S = str(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:i+3] == 'ABC':
        ans += 1
        
print(ans)

Solution (Python):
n = input()

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

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):
n1 = int(input())
s2 = input()

c3 = s2.count("ABC")

print(c3)

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

Solution (Python):

"""
Created on Sat May  9 14:21:04 2020

@author: shinba
"""

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

print(s.count("ABC"))

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

def counter(s,ans=0):
  if len(s) <= 2:
    return ans
  elif s[:3] == "ABC":
    return counter(s[1:],ans+1)
  else:
    return counter(s[1:],ans)

print(counter(S))

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

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

Solution (Python):
n = int(input())
s = str(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()
print(s.count('ABC'))

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

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

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

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

print(count)

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