#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans;
  cin >> n;
  char arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int cnt = 0, cnt1 = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == 'A') cnt++;
    if (arr[i] == 'I') cnt1++;
  }
  if (cnt1 > cnt || cnt1 == cnt && cnt > 0) {
    ans = cnt1;
  } else if (cnt1 == 0) {
    ans = cnt;
  } else if (cnt == 0 && cnt1 > 0) {
    ans = cnt;
  } else {
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}
