#include <bits/stdc++.h>
using namespace std;
int n;
char s[1000005 * 2];
int cnt1, cnt2, cnt3;
int main() {
  cin >> n;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == 'I') {
      flag = false;
      cnt3++;
    }
  }
  if (flag) {
    for (int i = 0; i < n; i++) {
      if (s[i] == 'A') cnt1++;
    }
    cout << cnt1 << endl;
    return 0;
  } else {
    cout << cnt3 << endl;
  }
  return 0;
}
