#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int count = 0;
  int count2 = 0;
  char arr[1000006];
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    scanf("%c", &arr[i]);
  }
  for (int j = 0; j <= n; j++) {
    if (arr[j] == 'A') {
      count++;
    }
    if (arr[j] == 'I') {
      count2++;
    }
  }
  if (count2 == 0) {
    cout << count << endl;
    return 0;
  }
  if (count2 == 1) {
    cout << 1 << endl;
  }
  if (count2 == 2) {
    cout << 0 << endl;
  }
  return 0;
}
