inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift()
S = inp.shift()
c = 0
for (i = 0; i < N - 2; i++) {
    if (S[i] == "A" && S[i+1] == "B" && S[i+2] == "C") {
        c++
    }
}
console.log(c)
