#include <bits/stdc++.h>
int main() {
  char c[200001] = {0};
  int i = 0, n = 0, A = 0, I = 0, res;
  scanf("%d", &n);
  fflush(stdin);
  gets(c);
  for (i = 0; i < n; i++) {
    if (c[i] == 'A') A++;
    if (c[i] == 'I') I++;
  }
  if (I == 0) res = A;
  if (I == 1) res = 1;
  if (I >= 2) res = 0;
  printf("%d", res);
}
