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