#include <bits\stdc++.h>
#define FIX 1000000007
using namespace std;

int main()
{
    int n , I  = 0, A = 0; cin >> n;
    string ch;
    cin >> ch;
    int ans = 0;
    for(int i = 0; i < n; i ++)
    {
        if(ch[i] == 'A' && (ch.find("I",i) == -1))
                ans ++;
        else if(ch[i] == 'I' && i == n-1)
            ans ++ , I++;
        else if(ch[i] =='I' &&(ch.find("A",i) != -1 || ch.find("F",i) != -1))
            ans ++ , I++;
    }
    if(I==n)
        ans = 0;
    cout << ans << endl;
}
