#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int N, i=0;
    string S, T="";
    cin >> N >> S;

    for (int i=0; i<N; i++){
        T += S[i];
        if (T.size() >= 7 && T.substr(T.size()-7, 7) == "CPCTCPC"){
            for (int j=0; j<3; j++) T.pop_back();
            T += "F";
        }
    }

    int ans=0;
    for (int i=0; i<T.size()-4; i++) if (T.substr(i, 5) == "CPCTF") ans++;

    cout << ans << endl;

    return 0;
}