import java.util.ArrayList;
import java.util.Scanner;

public class CowsAndPokerGame {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String str = s.next();
        int a = 0, i = 0;
        for(int j = 0; j < str.length(); j++) {
            if(str.charAt(j) == 'A') a++;
            if(str.charAt(j) == 'I') i++;
        }
        System.out.println(i == 0 || i == n ? a : i);
    }
}
