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();
		
		int count = 0;
		for(int i = 0; i<n.length(); i++) {
			if(n.charAt(i) == 'A')
				count++;
			else if(n.charAt(i) == 'I')
				count = 1;
		}
		System.out.println(count);
	}
}
