#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int w = count(s.begin(), s.end(), 'A');
  int k = count(s.begin(), s.end(), 'I');
  if (k > 0 && w == 0) {
    cout << 0 << "\n";
    return 0;
  } else if (k > 0 && w != 0)
    cout << k << "\n";
  else {
    cout << w << "\n";
  }
}
