#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ci = 0, ca = 0, cf = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'I')
      ci++;
    else if (s[i] == 'A')
      ca++;
    else
      cf++;
  }
  if (ci > 0)
    cout << ci;
  else
    cout << ca;
  return 0;
}
