#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
inline bool smax(T &x, L y) {
  return x < y ? (x = y, true) : false;
}
template <class T, class L>
inline bool smin(T &x, L y) {
  return x > y ? (x = y, true) : false;
}
int n;
string s;
int cnt1, cnt2;
int main() {
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A') cnt1++;
    if (s[i] == 'I') cnt2++;
  }
  if (cnt2) return cout << cnt2 << '\n', false;
  return cout << cnt1 << '\n', false;
}
