import java.util.Scanner;

public class practice {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		sc.next();
		String n = sc.next();
		boolean b = false;
		int count = 0;
		for(int i = 0; i<n.length(); i++) {
			if(n.charAt(i) == 'A') {
				count++;
				b = true;
			}
			else if(n.charAt(i) == 'I') {
				count = 1;
				if(b && i == n.length()-1)
					b = true;
				else 
					b= false;
			}
		}
		if(b) 
			System.out.println(count);
		else
			System.out.println("0");
		
	}
}
