line = readlines
len = line.length
i = 0

while i < len
    line[i] = line[i].chomp
    i += 1
end

N = line[0].to_i
S = line[1]

count = 0
for i in 1..N-2 do
  if S[i-1..i+1] == "ABC" then
    count += 1
  end
end
  
print count