import java.util.Scanner;

public class CodeForces {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String s = sc.next();

        int ci = 0;
        int ca = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'A') {
                ca++;
            } else if (s.charAt(i) == 'I')
                ci++;
        }

        if (ci > 0) {
            if (ca != 0) {
                System.out.println(ci);
            } else {
                System.out.println(0);
            }
        } else {
            System.out.println(ca);
        }
    }

}
