#include "testlib.h" #include using namespace std; using ll = long long; const ll MIN_N = 5; const ll MAX_N = 500000; int main() { registerValidation(); ll N = inf.readLong(MIN_N, MAX_N); inf.readEoln(); set st={'C', 'P', 'T', 'F'}; string cpctf = ""; string cpctcpc = ""; int ans = 0; for(int i = 0; i < N; i++){ char c = inf.readChar(); assert(st.count(c)); cpctf+=c; cpctcpc+=c; if(cpctf.size()>5) cpctf.erase(cpctf.begin()); if(cpctcpc.size()>7) cpctcpc.erase(cpctcpc.begin()); if(cpctf=="CPCTF" || cpctcpc=="CPCTCPC"){ ans++; cpctf.clear(); cpctcpc.clear(); } } inf.readEoln(); cout << ans << endl; inf.readEof(); }