import java.util.Scanner;

public class Task284B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String p = sc.next();
		sc.close();
		
		int o = 0;
		if (p.contains("I") && p.contains("A")) {
			for (int i = 0; i < n; i++) {
				if (p.charAt(i) == 'I') { o++; }
			}
		} else {
			for (int i = 0; i < n; i++) {
				if (p.charAt(i) == 'A') { o++; }
			}
		}
		System.out.println(o);
	}
}