n = int(raw_input());
r = raw_input();
A = r.count('A');
F = r.count('F');
I = r.count('I');
ans = 0;
for i in range(n):
    if r[i] in ['A', 'I']:
        if I - (r[i] == 'I') == 0:
            ans += 1;
print ans;
        