#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int x = 0;
  int y = 0;
  char c;
  cin >> n;
  for (int i = 0; i <= n; ++i) {
    cin >> c;
    if (c == 'A')
      x++;
    else if (c == 'I')
      y++;
  }
  if (y <= 1)
    cout << x;
  else {
    if (y > 1)
      cout << 0;
    else
      cout << 1;
  }
  return 0;
}
