#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ci = 0, ca = 0;
  cin >> n;
  char arr[n];
  cin >> arr;
  for (int i = 0; i < n; i++) {
    if (arr[i] == 'I')
      ci++;
    else if (arr[i] == 'A')
      ca++;
  }
  if (ci == 0)
    cout << ca;
  else if (ci == 1)
    cout << 1;
  else
    cout << 0;
  return 0;
}
