import java.util.Scanner;

public class Solution {
    public static void main(String[] args) throws Exception {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        String str = cin.next();
        int a = 0;
        int f = 0;
        int j = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == 'A') a++;
            if (str.charAt(i) == 'F') f++;
            if (str.charAt(i) == 'I') j++;
        }
        if (j == 0) {
            System.out.print(a);
        }
        if (j != 0) {
            System.out.print(j);
        }
    }
}