#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char ch;
  int a = 0, i = 0, f = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ch;
    if (ch == 'A') a++;
    if (ch == 'F') f++;
    if (ch == 'I') i++;
  }
  int ans;
  if (i > 1)
    ans = 0;
  else if (i == 1)
    ans = 1;
  else
    ans = a;
  cout << ans;
}
