#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  int n;
  scanf("%d", &n);
  char xx[211111];
  scanf("%s", &xx);
  bool f = 0;
  int a1 = 0, a2 = 0;
  for (int i = 0; xx[i]; i++) {
    if (xx[i] == 'I') f = 1;
    a1 += (xx[i] == 'A');
    a2 += (xx[i] == 'I');
  }
  if (f)
    printf("%d\n", a2);
  else
    printf("%d\n", a1 + a2);
}
