#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
long long n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int test = 1, tc = 1;
  while (test--) {
    cin >> n;
    string s;
    cin >> s;
    map<char, long long> maps;
    set<char> st;
    for (int i = 0; i < s.size(); i++) {
      st.insert(s[i]);
      maps[s[i]]++;
    }
    if (st.size() == 3 && maps['I'] == 1) {
      cout << "1" << endl;
    } else if (st.size() == 3) {
      cout << "0" << endl;
    } else if (st.size() == 2) {
      if (!maps['I']) {
        long long k = maps['A'];
        cout << k << endl;
      } else if (maps['A']) {
        cout << "0" << endl;
      } else {
        cout << maps['I'] << endl;
      }
    } else {
      if (*st.begin() == 'A') {
        cout << maps['A'] << endl;
      } else
        cout << "0" << endl;
    }
  }
  return 0;
}
