#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, num1 = 0, num2 = 0, ans = 0, ans1 = 0;
  char a[200001];
  cin >> n;
  getchar();
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (a[i] == 'A') num1++;
    if (a[i] == 'F') num2++;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 'I' && num1 >= 1 && num2 >= 1) {
      ans++;
    }
    if (a[i] == 'A' && num1 >= 2 && num2 >= 1) {
      ans1++;
    }
  }
  cout << ans + ans1 << endl;
  return 0;
}
