import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int al = Integer.parseInt(s.next());

        String str = s.next();
        int count1 = 0;
        int count2 = 0;

        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == 'I')
                count1++;
            else if (str.charAt(i) == 'A') {
                count2++;
            }
        }

        if (count1 == 0)
            System.out.println(count2);
        else
            System.out.println(count1);
    }
}
