#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  long long n;
  scanf("%I64d", &n);
  char stringinput[n + 1];
  long long countI = 0;
  long long countA = 0;
  long long countF = 0;
  bool flag = true;
  scanf("%s", &stringinput);
  for (long long i = 0; i < n; i++) {
    if (stringinput[i] == 'I') {
      flag = false;
      for (long long j = 0; j < n; j++) {
        if (stringinput[j] == 'I') countI++;
      }
      for (long long j = 0; j < n; j++) {
        if (stringinput[j] == 'A') countA++;
      }
      for (long long j = 0; j < n; j++) {
        if (stringinput[j] == 'F') countF++;
      }
      break;
    } else {
      flag = true;
    }
  }
  if (flag == true) {
    for (long long j = 0; j < n; j++) {
      if (stringinput[j] == 'A') countA++;
    }
  }
  if (countI > 0)
    printf("%I64d", countI + (countF - countA));
  else
    printf("%I64d", countA);
  return 0;
}
