#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m = 0, a, l = 0, g = 0, i, j;
  cin >> a;
  char arr[a];
  for (i = 0; i < a; i++) {
    if (arr[i] == 'A') {
      l++;
    } else if (arr[i] == 'F') {
      g++;
    } else {
      m++;
    }
  }
  if (m == 0) {
    cout << l;
  } else
    cout << m;
}
