#include <bits/stdc++.h>
const int INF = 100000000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
int n;
string ss;
int main() {
  cin >> n;
  cin >> ss;
  int A = 0, I = 0, F = 0;
  int ans = 0;
  for (int i = 0; i < (n); i++) {
    if (ss[i] == 'F') F++;
    if (ss[i] == 'A') A++;
    if (ss[i] == 'I') I++;
  }
  if (n == A || n == F)
    puts("0");
  else if (I != 0)
    cout << I << endl;
  else if (A != 0)
    cout << A << endl;
  else
    puts("0");
  return 0;
}
