#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char* s = new char[n];
  for (int i = 0; i < n; ++i) cin >> s[i];
  bool I = false;
  int countI = 0;
  int countA = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'I') {
      if (!I) I = true;
      ++countI;
    } else if (!I && s[i] == 'A')
      ++countA;
  }
  if (I)
    cout << countI << endl;
  else
    cout << countI + countA << endl;
  return 0;
}
