#include <bits/stdc++.h>
using namespace std;
int main() {
  bool test;
  int n, k = 0, a = 0, i1 = 0, f = 0;
  cin >> n;
  char *list = new char[n];
  string in;
  cin >> in;
  for (int i = 0; i < n; i++) list[i] = in[i];
  for (int i = 0; i < n; i++) {
    if (list[i] == 'A') a++;
    if (list[i] == 'F') f++;
    if (list[i] == 'I') i1++;
  }
  if (i1 == 0) {
    if (a > 0) k = a;
    cout << k;
    return 0;
  }
  k = i1;
  cout << k;
  return 0;
}
