#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    string a;
    cin >> a;
    long long cnti = 0, cnta = 0, cntf = 0;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == 'A')
        cnta++;
      else if (a[i] == 'I')
        cnti++;
      else if (a[i] == 'F')
        cntf++;
    }
    if (cnti == 0)
      cout << cnta << endl;
    else
      cout << cnti << endl;
  }
  return 0;
}
