import java.util.Scanner;
public class cows_and_poker {

	public static void main(String[] args) {
		Scanner abc=new Scanner(System.in);
		int sayi=abc.nextInt();
		int sayac=0;
		String sayi1=abc.next();
		sayi1=sayi1.toUpperCase();
		if (sayi==sayi1.length()) {
			for (int i = 0; i < sayi; i++) {
				if (sayi1.charAt(i)=='A') {
					sayac++;
				}
				else if (sayi1.charAt(i)=='I') {
					sayac=0;
					System.out.println("1");
					break;
				}
			}
			if (sayac!=0) {
				System.out.println(sayac);
			}
			
		}
	}

}
