import java.io.IOException; import java.io.InputStream; import java.util.Scanner; public class Main { static final char[] chars="CPCT".toCharArray(); static final char[] CPC="CPC".toCharArray(); static int last=0; public static void main(String[] args) { FastScanner scanner=new FastScanner(); int len=scanner.readInt(); scanner.read=0; int o=0; scanner.max=len; while (scanner.hasNextByte()){ skipTillCPCT(o,scanner); if(ableToBeF(scanner)) o++; } System.out.println(o); } private static boolean ableToBeF(FastScanner scanner){ last=0; int c=scanner.readByte(); if(c=='F') return true; for(int i=0;i<3;i++){ if(c!=CPC[i]){ last=c; return false; } if(i!=2) c=scanner.readByte(); } last=0; return true; } private static void skipTillCPCT(int last,FastScanner scanner){ int c; int index=0; if(last=='C') index++; while ((c=scanner.readByte())!=-1&&index!=3){ if(c!=chars[index]){ index=0; continue; } index++; } } private static class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; public int read=0; public int max=20; private boolean hasNextByte() { if(max<=read) return false; if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } return buflen > 0; } } private int readByte() { if (hasNextByte()){ read++; return buffer[ptr++]; } else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} public int readInt(){ int b = readByte(); int n=0; while(true){ if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; }else if(b == -1 || !isPrintableChar(b)){ return n; }else{ throw new NumberFormatException(); } b = readByte(); } } } }