#include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int N = 1e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt1 = 0;
  for (char c : s)
    if (c == 'I') cnt1++;
  if (cnt1 > 1)
    cout << 0;
  else if (cnt1 == 1)
    cout << 1;
  else {
    int res = 0;
    for (char c : s)
      if (c == 'A') res++;
    cout << res << endl;
  }
}
