#include <bits/stdc++.h>
using namespace std;
string s;
int n, a, f, j;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') {
      a++;
    } else if (s[i] == 'F') {
      f++;
    } else {
      j++;
    }
  }
  if (a + f == n) {
    cout << max(a, f);
  } else {
    cout << j;
  }
  return 0;
}
