import java.util.Scanner;
/**
 *
 * @author ahmad97
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    @SuppressWarnings("empty-statement")
    public static void main(String[] args) {
    Scanner console  = new Scanner (System.in) ;
        int n = console.nextInt() ; 
        String x = console.next() ;
        int count = 0 ; 
        if (x.contains("I")&&(!x.contains("F")||!x.contains("A"))){
            for (int i=0 ; i<x.length() ; i++){
                if (x.charAt(i)=='I')
                    count ++ ; 
            }
        }
        else {
            for (int i=0 ; i<x.length() ; i++){
                if (x.charAt(i)=='A')
                    count ++ ; 
            }
        }
        
        System.out.println(count);
    }
}