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