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