#include <bits/stdc++.h>
char a[200005];
int main() {
  int t;
  scanf("%d", &t);
  scanf("%s", a);
  int c = 0, flag = 0;
  for (int i = 0; i < t; i++) {
    if (a[i] == 'A') {
      c++;
    } else if (a[i] == 'I') {
      flag++;
    }
  }
  if (flag == 1) {
    c = c + flag;
  } else if (flag > 1) {
    c = 0;
  }
  printf("%d\n", c);
  return 0;
}
