import java.io.*;
import java.util.*;
import java.math.*;

public class Main {

    public static void main(String args[]) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = t_int(br);
        char[] p = br.readLine().toCharArray();
        int[] aif = new int[3];
        for (char c : p) {
            if (c == 'A') {
                aif[0]++;
            } else if (c == 'I') {
                aif[1]++;
            } else {
                aif[2]++;
            }
        }

        int show = (aif[0] == 0) ? aif[1] : aif[0];
        System.out.println(show);

        br.close();
    }

    public static int t_int(BufferedReader br) throws Exception {
        return Integer.parseInt(br.readLine());
    }

    public static StringTokenizer t_st(BufferedReader br) throws Exception {
        return new StringTokenizer(br.readLine());
    }

    public static int[] t_int_a(BufferedReader br, int n) throws Exception {
        StringTokenizer st = t_st(br);
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
        return a;
    }
}
