#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL);
  int n;
  string s;
  cin >> n >> s;
  int A, first;
  A = first = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A')
      A++;
    else if (s[i] == 'F')
      first++;
  }
  if (first + A == (int)s.size()) {
    cout << A;
    return 0;
  } else if (first + A == n - 1) {
    int idx;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'I') {
        idx = i;
        break;
      }
    }
    int ans = 1;
    for (int i = idx + 1; i < s.size(); i++) {
      if (s[i] == 'A') ans++;
    }
    cout << ans;
  } else
    cout << 0;
  return 0;
}
