#include <bits/stdc++.h>
int main() {
  long n;
  while (~scanf("%ld", &n)) {
    char a[1000] = {0};
    scanf("%s", a);
    long i, j, k = 0, l = 0, c = 0;
    for (i = 0; i < n; i++) {
      if (a[i] == 'A')
        c++;
      else if (a[i] == 'I')
        k++;
      else
        l++;
    }
    if (k == 0 && c > 0)
      printf("%ld\n", c);
    else
      printf("%ld\n", k);
  }
  return 0;
}
