#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, ans, coun_A = 0, coun_I = 0, coun_F = 0;
  char temps;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> temps;
    if (temps == 'A') coun_A++;
    if (temps == 'I') coun_I++;
    if (temps == 'F') coun_F++;
  }
  if (coun_I > 1) ans = 0;
  if (coun_I == 1 && coun_A > 0) ans = 1;
  if (coun_I == 0) ans = coun_A;
  cout << ans;
  return 0;
}
