def main():
    n = int(raw_input())
    s = raw_input().strip()

    i = 0
    a = 0
    for c in s:
        if c == 'I':
            i += 1
        if c == 'A':
            a += 1

    if i == 1:
        print 1
    else:
        if i == 0:
            print a
        else:
            print 0


if __name__ == "__main__":
    main()
