def raw():
    return raw_input().strip()


def ints():
    return map(int, raw().split())

n = ints()[0]
s = raw()
r = 0
ip = []
ii = False

for i in xrange(n):
    if s[i] == 'I':
        ip.append(s[i])
        ii = True

is_len = len(ip)

for i in xrange(n):
    p = s[i]
    if p != 'F':
        if p == 'A':
            if ii is False:
                r += 1
        if p == 'I':
            if is_len == 1:
                r += 1

print r
