#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  char temp;
  cin >> n;
  int A = 0, F = 0, I = 0;
  for (i = 0; i < n; i++) {
    cin >> temp;
    if (temp == 'A') {
      A++;
      continue;
    }
    if (temp == 'F') {
      F++;
      continue;
    }
    if (temp == 'I') {
      I++;
      continue;
    }
    if (I > 1) {
      cout << "0";
      break;
    }
  }
  if (I == 1)
    cout << "1";
  else
    cout << A;
}
