import java.util.Scanner;

public class _0795CowsandPokerGame {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.nextLine();
		String s=sc.nextLine();
		int ans=0;
		if(s.indexOf('I')==-1 || s.indexOf('I')==s.lastIndexOf('I')) {
			for(int i=0;i<s.length();i++) {
				if(s.charAt(i)=='A') {
					ans++;
				}
			}
			if(s.indexOf('I')==s.lastIndexOf('I'))ans++;
		}
		System.out.println(ans);	
	}

}
