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