#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, IN = 0, ALLIN = 0, F = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A')
      ALLIN++;
    else if (s[i] == 'I')
      IN++;
    else
      F++;
  }
  if (IN == 0)
    cout << ALLIN << endl;
  else if (ALLIN != 0 && IN == 1)
    cout << IN << endl;
  else
    cout << 0 << endl;
  return 0;
}
