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