
import java.util.Scanner;

public class B {
	public static void main(String [] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		char[] c = in.next().toCharArray();
		int ans = 0 ;
		for(int i = n-1 ; i >= 0 ; i--){
			if(c[i]=='A'){
				ans++;
			}
			else if (c[i]=='I'){
				ans++;
				break;
			}
		}
		System.out.println(ans);
	}
}
