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