import java.util.*;
public class CowPokerGame
{
	public static void main(String args[])
	{
		int cnt=0;
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.nextLine();
		String str = s.nextLine();
		char ch[] =str.toCharArray();
		Arrays.sort(ch);
		String str1 = new String(ch);
		
		int na = str1.lastIndexOf('A')+1;
		int nf = str1.lastIndexOf('F') - str1.indexOf('F') +1;
		int ni = str1.lastIndexOf('I') - str1.indexOf('I') +1;
		
		if(ni==0)cnt=na;
		else if(ni==1)cnt=1;
		else cnt=0;
		System.out.println(cnt);
	}
}

