#include <bits/stdc++.h>
using namespace std;
int main() {
  char f[200010];
  int64_t ta = 0, ti = 0, tf = 0, n;
  cin >> n;
  cin >> f;
  for (int i = 0; i < n; i++) {
    if (f[i] == 'A')
      ta++;
    else if (f[i] == 'I')
      ti++;
    else
      tf++;
  }
  if (ta + tf == n)
    cout << ta;
  else if (tf > 0)
    cout << ti;
  else
    cout << 0;
  return 0;
}
