#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    string S;
    cin>>N>>S;
    int an=0;
    for(int i=0;i<N;i++){
        if(i+4<N&&S.substr(i,5)=="CPCTF"){
            an++;
            i+=4;
        }
        if(i+6<N&&S.substr(i,7)=="CPCTCPC"){
            an++;
            i+=6;
        }
    }
    cout<<an<<endl;
}