import java.util.*;
import java.io.*;

public class CowPoker {
	public static void main(String[] args) throws IOException {
		BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(rd.readLine());
		String S = rd.readLine();
		boolean both = false;
		boolean A = false;
		boolean I = false;
		for(int i=0; i<S.length(); i++){
			if(S.charAt(i)=='A') A = true;
			if(S.charAt(i)=='I') I = true;
		}
		if(A && I){
			int cnt = 0;
			for(int i=0; i<n; i++) if(S.charAt(i)=='I') cnt++;
			if(cnt>1) cnt = 0;
			System.out.println(cnt);
			return;
		}
		int cnt = 0;
		for(int i=0; i<n; i++) if(S.charAt(i)=='A') cnt++;
		if(S.indexOf("I")!=-1) cnt = 0;
		System.out.println(cnt);
	}
}
