#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  int sumA;
  int sumF;
  int sumI;
  while (cin >> n) {
    sumA = sumF = sumI = 0;
    cin >> s;
    for (int i = 0; i < s.length(); ++i) {
      if (s[i] == 'A')
        sumA++;
      else if (s[i] == 'F')
        sumF++;
      else
        sumI++;
    }
    if (sumA >= sumI)
      cout << sumA << endl;
    else
      cout << sumI << endl;
  }
  return 0;
}
