#include <bits/stdc++.h>
using namespace std;
double area_triangle(double x1, double y1, double x2, double y2, double x3,
                     double y3) {
  double a;
  a = x1 * (y2 - y3) + y1 * (x3 - x2) + ((x2 * y3) - (y2 * x3)) + 1e-9;
  a = a / 2 + 1e-9;
  return a;
}
double dist_2point(double x1, double y1, double x2, double y2) {
  double d;
  d = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
  return d;
}
int binary_search(int a[], int n, int l, int u) {
  int mid;
  if (l > u) return 0;
  mid = floor(l + u) / 2;
  if (a[mid] == n)
    return mid;
  else if (a[mid] > n)
    binary_search(a, n, l, mid - 1);
  else
    binary_search(a, n, mid + 1, u);
}
long gcd(long a, long b) {
  while (b > 0) {
    a = a % b;
    a = a ^ b;
    b = b ^ a;
    a = a ^ b;
  }
  return a;
}
long lcm(long a, long b) {
  long x = (a * b) / gcd(a, b);
  return x;
}
long is_prime(long n) {
  long ii;
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (ii = 3; ii * ii <= n; ii = ii + 2)
    if (n % ii == 0) return 0;
  return 1;
}
set<long> set1, set2;
set<string> sets;
set<long>::iterator sit;
multiset<long> multiset;
vector<pair<long, long> > vect2;
vector<long> vect1;
vector<long>::iterator vit;
map<long, long> map1;
map<string, long> map2;
map<long, bool> map3;
int main() {
  long test;
  while (cin >> test) {
    string a;
    cin >> a;
    long l, i, s = 0, ss = 0, sss = 0;
    for (i = 0; i < test; i++) {
      if (a[i] == 'A')
        s++;
      else if (a[i] == 'I')
        ss++;
      else if (a[i] == 'F')
        sss++;
    }
    s = max(s, ss);
    s = max(s, sss);
    cout << s << endl;
  }
  return 0;
}
