#include <bits/stdc++.h>
using namespace std;
int main() {
  int A = 0, I = 0, i, n;
  char c;
  scanf("%d\n", &n);
  for (i = 1; i <= n; i++) {
    c = getchar();
    if (c == 'I')
      I++;
    else if (c == 'A')
      A++;
  }
  if (I > 0)
    printf("%d\n", I);
  else
    printf("%d\n", A);
  return 0;
}
