#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a1 = 0;
  int f1 = 0;
  int i1 = 0;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') {
      a1++;
    } else if (s[i] == 'F') {
      f1++;
    } else if (s[i] == 'I') {
      i1++;
    }
  }
  int m1 = max(a1, f1);
  int m2 = max(m1, i1);
  cout << max(m1, m2) << endl;
  return 0;
}
