#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int a, aa = 0, ii = 0;
  bool ch = false;
  cin >> a >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'I')
      ii++;
    else if (s[i] == 'A')
      aa++;
  }
  if (ii == 0)
    cout << aa << endl;
  else
    cout << ii << endl;
  return 0;
}
