#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int c = 0;
  int c1 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') {
      c++;
    }
    if (s[i] == 'I') {
      c1++;
    }
  }
  if (c1 != 0) {
    cout << c1;
  } else if (c1 == 0 && c != 0) {
    cout << c;
  } else {
    cout << 0;
  }
  return 0;
}
