import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class B {
    private final Scanner in=new Scanner(System.in);
    private final PrintWriter out=new PrintWriter(System.out,true);
    private final PrintWriter debug=new PrintWriter(System.err,true);
    public static void main(String[] args) throws IOException {
        new B().solve();
    }
    
    /**
     * @throws IOException 
     * 
     */
    private void solve() throws IOException {
        int n = in.nextInt();
        int i=0;
        int a=0;
        int f=0;
        for(int x=0;x<n;x++){
            char c = (char)System.in.read();
            if(c=='I'){
                i++;
            }
            if(c=='A'){
                a++;
            }
            if(c=='F'){
                f++;
            }
        }
        int result;
        if(i>1){
            result=0;
        }else if(i==1){
            result=1;
        }else{
            result=a;
        }
        out.println(result);
        out.flush();
    }

}