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;
		boolean f = false;
		boolean z = false;
		for (int i = 0; i < n.length(); i++) {
			if (n.charAt(i) == 'A') {
				count++;
				b = true;
				if(z)
					count = 0;
				break;
				
			} else if (n.charAt(i) == 'I') {
				count = 1;
				if (b && i == n.length() - 1)
					b = true;
				else if (f)
					b = true;
				else
					b = false;
				z = true;
			} else {
				f = true;
			}
		}
		if (b)
			System.out.println(count);
		else
			System.out.println("0");

	}
}
