#include using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int N; string s; cin >> N >> s; int i = 0, ans = 0; while(1) { auto p = s.find("CPCT", i); if(p == string::npos) break; int j = p; if(s.substr(j + 4, 3) == "CPC") { ans++; i = j + 7; } else if(s.substr(j + 4, 1) == "F") { ans++; i = j + 5; } else i = j + 4; } cout << ans << endl; }