#include <bits/stdc++.h>
using namespace std;
const int MAXH = 1010;
const int MAXW = 1010;
int main() {
  int n;
  string cad;
  cin >> n >> cad;
  int a, b, c;
  for (int i = 0; i < n; i++) {
    if (cad[i] == 'A')
      a++;
    else if (cad[i] == 'I')
      b++;
    else
      c++;
  }
  if (b == 0)
    cout << a << endl;
  else {
    cout << b << endl;
  }
  return 0;
}
