#include <bits/stdc++.h>
int main() {
  int n, i, count = 0, count_a = 0, count_b = 0;
  char a;
  scanf("%d", &n);
  getchar();
  for (i = 0; i < n; i++) {
    scanf("%c", &a);
    if (a == 'A') {
      count++;
    }
    if (a == 'I') {
      count = 1;
    }
  }
  printf("%d\n", count);
  return 0;
}
