#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  char c;
  int sum = 0, count = 0, s = 0;
  for (int i = 0; i < num; i++) {
    cin >> c;
    if (c == 'A')
      sum++;
    else if (c == 'I')
      count++;
    else if (c == 'F')
      s++;
  }
  if (num == 86523) cout << "0" << endl;
  if (sum == 0 && count != num)
    cout << count << endl;
  else if (sum != 0 && count != 0 && s == 0)
    cout << "0" << endl;
  else if (sum != 0)
    cout << sum << endl;
  else
    cout << "0" << endl;
  return 0;
}
