
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        in.readLine();
        String s = in.readLine();
        int I = 0;
        int A = 0;
        for (int i = 0; i < s.length(); i++)
            if (s.charAt(i) == 'I')
                I++;
            else if (s.charAt(i) == 'A')
                A++;
        if (I > 2)
            System.out.println(0);
        else if (I == 1)
            System.out.println(1);
        else
            System.out.println(A);
    }
}
