
import java.util.Scanner;

public class JavaApplication40 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String s= in.nextLine();
        int count_i = 0;
        int count_a = 0;
        int count_f = 0;
        for(int i = 0; i<n; i++){
            if(s.charAt(i)=='A'){
                count_a++;
                
            }
            else if(s.charAt(i)=='I'){
                count_i++;
            }
            else{
                count_f++;
            }
        }
        
        if(count_i!=0 ||  count_a!=0){
            
             if(count_f==0 && count_a!=0 && count_i==0){
                System.out.println(count_a);
            }
            else if(count_f!=0 && count_a==count_i){
                System.out.println(count_i);
            }
            else if(count_a==0 && count_i!=0 && count_f==0){
                System.out.println(0);
            }
            else if(count_a==0 && count_i!=0 && count_f!=0){
                System.out.println(count_i);
            }
            else if(count_i==0 && count_a!=0){
                System.out.println(count_a);
            }
        }
        else{
            System.out.println(0);
        }
        
    }
    
}
