#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} b[1000100];
bool cmp(node q, node p) { return q.x < p.x; }
int a[1000100];
void prime() {
  int i, j;
  a[0] = a[1] = 1;
  for (i = 2; i <= 2010; i++)
    if (!a[i])
      for (j = i + i; j <= 2010; j += i) a[j] = 1;
}
char str[1000100];
int main() {
  int n, m, i, j, k, t, cnt = 0;
  while (scanf("%d", &n) != EOF) {
    scanf("%s", str);
    cnt = 0;
    for (i = 0; i < n; i++)
      if (str[i] == 'I') cnt++;
    if (cnt) {
      printf("%d\n", cnt);
      continue;
    } else {
      cnt = 0;
      for (i = 0; i < n; i++)
        if (str[i] == 'A') cnt++;
    }
    printf("%d\n", cnt);
  }
}
