import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class sum2 {
	
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) throws IOException {
		FastReader scan=new FastReader();
		int n=scan.nextInt();
		String s=scan.next();
		boolean a[]=new boolean[3];
		int b[]=new int [3];
		for(int i=0;i<s.length();i++){
			if(s.charAt(i)=='A'){
				b[0]++;
				a[0]=true;
			}
			else if(s.charAt(i)=='F'){
				b[1]++;
				a[1]=true;
			}
			else if(s.charAt(i)=='I'){
				b[2]++;
				a[2]=true;
			}
		}
		int count=0;
		if(a[1]==false){
			count=b[0]+b[2];
		}
		else{
			if(a[2]==true){
				count=b[2];
			}
			else{
				if(a[0]==true){
					count=b[0];
				}
				else{
					count=b[2];
				}
			}
		}	
		System.out.println(count);
	}
}

