#include <stdio.h>
#include <conio.h>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <vector>
#include <string>

using namespace std;

int main()
{
	long int n;
	cin>>n;
	vector <char> a(n);
	int count_i = 0, count_a = 0, count_f = 0;
	for (int i = 0; i < n; ++i){
		cin>>a[i];
		if(a[i] == 'I')
			++count_i;
		else if (a[i] == 'A')
			++count_a;
		else if (a[i] == 'F')
			++count_f;
	}
	if (count_i == 0){
		if (count_a > 0 && count_f > 0)
			cout<<count_a<<endl;
		else if ((count_a > 0 && count_f == 0) || (count_a == 0 && count_f > 0))
			cout<<0<<endl;
	}
	else if (count_i > 0){
		if (count_a>0 || count_f>0)
			cout<<count_i<<endl;
		else
			cout<<0<<endl;
	}
	return 0;
}