#include <bits/stdc++.h>
int main() {
  int n;
  while (scanf("%d\n", &n) != EOF) {
    char state;
    int countI = 0, countA = 0;
    for (int i = 0; i < n; i++) {
      scanf("%c", &state);
      if (state == 'A') {
        countA++;
        continue;
      }
      if (state == 'I') {
        countI++;
        if (countI > 1) {
          break;
        }
      }
    }
    if (countI == 1) {
      printf("1\n");
    } else if (countI == 0) {
      printf("%d\n", countA);
    } else {
      printf("0\n");
    }
  }
}
