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