#include <bits/stdc++.h>
using namespace std;
char ch[200009];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", ch);
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (ch[i] == 'I') ans++;
  if (ans == 0)
    for (int i = 0; i < n; i++)
      if (ch[i] == 'A') ans++;
  printf("%d\n", ans);
  return 0;
}
