#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a(0), f(0), i(0);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A')
      a++;
    else if (s[i] == 'I')
      i++;
  }
  cout << ((i == 0) ? a : i);
  return 0;
}
