#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, counter = 0;
  string x, z;
  cin >> t;
  cin >> x;
  int y = x.find("F");
  if (y > -1) {
    for (int m = 0; m < t; m++) {
      z = x.at(m);
      if (z == "A") counter++;
    }
  }
  cout << counter;
  return 0;
}
