#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  map<char, int> m;
  bool I = false, A = false, F = false;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    if (c == 'I')
      I = true;
    else if (c == 'A')
      A = true;
    else
      F = true;
    m.insert({c, ++m[c]});
  }
  if (I == true) {
    if (A == true || F == true) {
      cout << m['I'] << endl;
    } else {
      cout << "0\n";
    }
  } else if (A == true) {
    cout << m['A'] << endl;
  } else {
    cout << "0\n";
  }
  return 0;
}
