#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, d = 0, c = 0, e = 0;
  char ch;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ch;
    if (ch == 'I') c++;
    if (ch == 'A') d++;
    if (ch == 'F') e++;
  }
  if ((d == 0 && e == 0) || (d == 0 && c == 0) || (d <= 1 && c == 0 && e == 0))
    cout << "0";
  else if (d > 1 && c == 0 && e == 0)
    cout << d;
  else if ((c != 0 && (d != 0 || e != 0)) || (c != 0 && d != 0 && e != 0))
    cout << c;
  else if (c == 0 && d != 0 && e != 0)
    cout << d;
}
