#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, ans1 = 0;
  string s;
  bool t = 1;
  cin >> n >> s;
  for (int i = 0; i < ((int)s.size()); i++) {
    if (t == 0 || s[i] == 'I') {
      ans1++;
      t == 0;
    }
    if (t == 1 && s[i] == 'A') {
      ans++;
    }
  }
  if (t == 0)
    cout << ans1 << endl;
  else
    cout << ans << endl;
  return 0;
}
