#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, na = 0, ni = 0, ans = 0;
  char temp;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    if (temp == 'A') ++na;
    if (temp == 'I') {
      ++ni;
      ans = 1;
    }
  }
  cout << (ans == 0 ? na : ni);
  return 0;
}
