#include <bits/stdc++.h>
using namespace std;
int main() {
  bool flag = false;
  long long n, sum = 0, f = 0, in = 0, a = 0;
  char arr[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 'I') in++;
    if (arr[i] == 'A') a++;
    if (arr[i] == 'F') f++;
  }
  if (f == 0 && a > in && in != 0)
    sum = in;
  else if (f > 0 && a > 0 && in > 0)
    sum = in;
  else if (in == 0)
    sum = a;
  cout << sum;
}
