#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long ar[1000 * 1000 + 5], ar1[1000 * 1000 + 5], arr[105][105];
long long n, nn, m, mm = 0, i, ii, j, jj, k, l, mn = 1000 * 1000 + 5,
                    mx = -1000 * 1000 + 5, ans, sum, cnt = 1, a = 0, b, x, y,
                    tt;
string s, s1, second;
int main() {
  a = 0;
  mm = 0;
  nn = 0;
  b = 0;
  x = 0;
  cin >> n;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'A') {
      b++;
    }
  }
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'F') {
      x++;
    }
  }
  if (b > 0 and x > 0) {
    for (i = 0; i < s.size(); i++) {
      if (s[i] == 'I') {
        mm++;
      }
    }
    if (mm > 0) {
      cout << mm;
      return 0;
    }
  } else {
    for (i = 0; i < s.size(); i++)
      if (s[i] == 'A' and mm == 0) {
        nn++;
      }
  }
  cout << nn;
  return 0;
}
