#include <bits/stdc++.h>
using namespace std;
int s, t = 0, cnt = 0, ct = 0, r, p;
string st;
int main() {
  cin >> s >> st;
  for (int i = 0; i < s; i++) {
    if (st[i] == 'A') t++;
    if (st[i] == 'I') cnt++;
    if (st[i] == 'F') ct++;
  }
  p = max(t, cnt);
  r = max(ct, p);
  if (ct == r)
    cout << 0;
  else
    cout << r;
  return 0;
}
