#include <bits/stdc++.h>
using namespace std;
int main() {
  int counterI = 0, counterA = 0, counterF = 0;
  long int x = 0;
  cin >> x;
  char str[x];
  for (int i = 0; i < x; i++) cin >> str[i];
  for (int i = 0; i < x; i++)
    if (str[i] == 'I') counterI++;
  for (int i = 0; i < x; i++)
    if (str[i] == 'F') counterF++;
  for (int i = 0; i < x; i++)
    if (str[i] == 'A') counterA++;
  if (counterI > 0 && counterA > 0 && counterF > 0)
    cout << counterI << endl;
  else if (counterI == 0 && counterA > 0 && counterF > 0)
    cout << counterA << endl;
  else if (counterI > 0 && counterA == 0 && counterF > 0)
    cout << 0 << endl;
  else if (counterI == 0 && counterA == 0 && counterF > 0)
    cout << 0 << endl;
  else if (counterI == 0 && counterA > 0 && counterF == 0)
    cout << counterA << endl;
  else if (counterI > 0 && counterA == 0 && counterF == 0)
    cout << counterI << endl;
  else if (counterI > 0 && counterA > 0 && counterF == 0)
    cout << counterA + counterI << endl;
  return 0;
}
