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