import numpy as np



def main():

    N = int(eval(input()))

    S = eval(input())



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



    return 0



if __name__ == '__main__':

    main()
N = int(eval(input()))

S = eval(input())



ans = 0

for i in range(N-2):

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

        ans += 1

print(ans)



import numpy as np


def main():
    N = int(eval(input()))
    S = eval(input())
    print((S.count("ABC")))
    return 0


if __name__ == "__main__":
    main()

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

-import numpy as np - - -def main(): -    N = int(eval(input())) -    S = eval(input()) -    print((S.count("ABC"))) -    return 0 - - -if __name__ == "__main__": -    main() +N = int(eval(input())) +S = eval(input()) +ans = 0 +for i in range(N - 2): +    if S[i : i + 3] == "ABC": +        ans += 1 +print(ans)