import java.util.*;
public class Main {
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.nextLine();
    String cp = sc.nextLine();
    int Aco = 0;
    int Ico = 0;
    for(int i=0; i<n; i++){
        if(cp.charAt(i) == 'A'){
            Aco ++;
        }else{
            if(cp.charAt(i) == 'I')
                Ico ++;
        }
    }
    if(Ico == 0){
        System.out.println(Aco);
    }else{
        System.out.println(Ico);
    }
}

}
