import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CowsAndPokerGame {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.flush();
    }
    static class TaskB{
        void solve(int t,InputReader in,PrintWriter out){
            int n = in.nextInt();
            char s[] = in.next().toCharArray();
            int IN = 0;
            for (int i = 0; i < n; i++) {
                if(s[i] == 'I')
                    IN++;
            }
           
            if(IN == 0){
                int ans = 0;
                for (int i = 0; i < n; i++) {
                    if(s[i] == 'A')
                        ans++;
                }
                out.println(ans);
                return ;
            }
            if(IN == 1){
                out.println(1);
                return;
            }
            else{
                int a = 0 , b = 0;
                for(int i = 0 ;i < n;i++){
                    if(s[i] == 'A' )
                        a++;
                if(s[i] == 'I')
                    b++;
                    }
                if(a >= b)
                    out.println(a);
                else out.println(0);
            }
        }
    }
    static class InputReader{
        public BufferedReader reader;
        public StringTokenizer tk;
        public InputReader(InputStream stream){
            reader = new BufferedReader(new InputStreamReader(stream));
            tk = null;
        }
        String next(){
            while(tk == null || !tk.hasMoreTokens()){
                try{
                    tk = new StringTokenizer(reader.readLine());
                }
                catch(IOException e){
                    throw new RuntimeException(e);
                }
            }
            return tk.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
    }
}
