#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, i, m, n;
  char c[2 * 1000000], ch;
  scanf("%d%c", &n, &ch);
  gets(c);
  a = 0, i = 0;
  for (m = 0; m < n; m++) {
    if (c[m] == 'A') a++;
    if (c[m] == 'I') i++;
  }
  if (i > 0)
    printf("%d\n", i);
  else
    printf("%d\n", a);
  return 0;
}
