#include <bits/stdc++.h>
using namespace std;
int main() {
  long int count = 0, i, n, a[3] = {0};
  string s;
  cin >> n >> s;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == 'A')
      a[0]++;
    else if (s[i] == 'I')
      a[1]++;
    else
      a[2]++;
  }
  if (a[1] == 0)
    count = a[0];
  else if (a[1] == 1) {
    if (a[0] > 0)
      count = a[0];
    else
      count = 1;
  }
  cout << count << endl;
  return 0;
}
