#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0, cnt = 0, ni = 0;
  char c;
  cin >> n;
  while ((i++) <= n) {
    c = getchar();
    if (c == 'I')
      ni++;
    else if (c == 'A' || c == 'I')
      cnt++;
    if (ni >= 2) {
      cnt = 0;
      break;
    }
  }
  cout << cnt << endl;
  return 0;
}
