import java.util.Scanner;

public class CowsAndBokerGame {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		int n = input.nextInt();
		String s = input.next().trim();
		input.close();
		int cnt_I  = 0;
		int cnt_A = 0 ;
		for(int i = 0 ; i < n ; i++){
			if(s.charAt(i) == 'I'){
				cnt_I ++ ;
			}else if(s.charAt(i) == 'A'){
				cnt_A ++ ;
			}
		}
		if(cnt_I == 1){
			System.out.println(cnt_I);
		}else if (cnt_I == n ) {
			System.out.println(0);
		}else {
			System.out.println(cnt_A + cnt_I);
		}
	}

}
