#include <bits/stdc++.h>
using namespace std;
int a[200001];
int main() {
  int n, count1 = 0, count2 = 0;
  char c;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c;
    if (c == 'A') a[i] = 1, count1++;
    if (c == 'I') a[i] = 2, count2++;
    if (c == 'F') a[i] = 3;
  }
  if (count2 >= 2) cout << 0 << endl;
  if (count2 == 1)
    cout << 1 << endl;
  else
    cout << count1 << endl;
  return 0;
}
