import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int ico = 0;
        int c = 0;
        for (int i = 0; i < n; i++) {
            if(s.charAt(i) == 'A') {
                c++;
            }
            else if(s.charAt(i) == 'I') {
                c = 1;
                ico++;
                if(ico == 2) {
                    c = 0;
                    break;
                }
            }
        }
        System.out.println(c);
    }
}