#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
signed main() {
  int t, n, k, a = 0, l = 0, f = 0;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A') a++;
    if (s[i] == 'F') f++;
    if (s[i] == 'I') l++;
  }
  if (l == 0) {
    cout << a << endl;
  } else {
    if (l == s.length())
      cout << 0 << endl;
    else
      cout << l << endl;
  }
  return 0;
}
