#include <bits/stdc++.h>
using namespace std;
string S;
char In[2 * 100010];
long long Ans, i, j, k, N, M, L, Inn, AL;
bool in;
int main() {
  cin >> L;
  for (i = 0; i < L; i++) {
    cin >> In[i];
    if (In[i] == 'A')
      AL++;
    else if (In[i] == 'I')
      Inn++;
  }
  if (Inn == 0)
    cout << AL << endl;
  else
    cout << Inn << endl;
  return 0;
}
