#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, res, j, k, l, a[4];
  scanf("%d", &n);
  char ch[n + 1];
  j = 0;
  k = 0;
  l = 0;
  scanf("%s", ch);
  getchar();
  for (i = 0; i < n; i++) {
    if (ch[i] == 'F')
      j++;
    else if (ch[i] == 'A')
      k++;
    else
      l++;
  }
  a[0] = j = 0;
  a[1] = k;
  a[2] = l;
  sort(&a[0], &a[3]);
  printf("%d\n", a[2]);
  return 0;
}
