There are n cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may show his/her hand to the table. However, so as not to affect any betting decisions, he/she may only do so if all other players have a status of either "ALLIN" or "FOLDED". The player's own status may be either "ALLIN" or "IN".

Find the number of cows that can currently show their hands without affecting any betting decisions.


-----Input-----

The first line contains a single integer, n (2 ≤ n ≤ 2·10^5). The second line contains n characters, each either "A", "I", or "F". The i-th character is "A" if the i-th player's status is "ALLIN", "I" if the i-th player's status is "IN", or "F" if the i-th player's status is "FOLDED".


-----Output-----

The first line should contain a single integer denoting the number of players that can currently show their hands.


-----Examples-----
Input
6
AFFAAA

Output
4

Input
3
AFI

Output
1



-----Note-----

In the first sample, cows 1, 4, 5, and 6 can show their hands. In the second sample, only cow 3 can show her hand.

Difficulty: interview

Starter code:

Solutions:
n=int(input())
a=input()
cnt=0
A=0
for i in range(0,n):
  if(a[i]=='I'): cnt+=1
  if(a[i]=='A'): A+=1
if(cnt==0):
    print(A)
elif(cnt==1):
    print(1)
else :print(0)


from collections import Counter
def go():
  n = int(input())
  d = Counter()
  for c in input():
    d[c] += 1
  if d['I'] == 0: return d['A']
  elif d['I'] == 1: return 1
  else: return 0

print(go())


import sys
f = sys.stdin
#f = open("input.txt", "r")
def solve():
    n = int(f.readline())
    b = f.readline()
    count = 0
    if b.count("I") == 1:
        print(1)
        return
    elif b.count("I") > 1:
        print(0)
        return
    else:
        b = b.replace("I", "")
        print(b.count("A"))
solve()

N=int(input())

s=input()

x=s.count('I')

if(x==0):
    print(s.count('A'))
elif(x==1):
    print(1)
else:
    print(0)


n = int(input())
s = input()
a,i = s.count('A'), s.count('I')
print((a,1,0)[min(i,2)])

n = int(input())
t = input()
k = t.count('I')
if k > 1: print(0)
elif k == 1: print(1)
else: print(t.count('A'))

# your code goes here
n = int(input())
players = input()
show_players = 0


index = players.find('I')
index2 = players[index + 1:].find('I')

if index2 == -1:
	if index == -1:
		print(players.count('A'))
	else:
		print(1)
else:
	print(0)


n = int(input())
s = input()
if s.count('I') > 1:
    print(0)
elif s.count('I') == 1:
    print(1)
else:
    print(s.count('A'))



n = int(input())
s = input()
print([s.count('A'),1,0][min(s.count('I'),2)])

import sys
import math
  
n = int(sys.stdin.readline())
an = sys.stdin.readline()

d = [0] * 3

for i in range(n):
    if(an[i] == 'A'):
        d[0] += 1
    elif(an[i] == 'F'):
        d[1] += 1
    elif(an[i] == 'I'):
        d[2] += 1
   
if(d[2] == 1):
    if(d[1] != 0 or d[0] != 0):
        print(d[2])
    else:
        print(0)
elif(d[0] != 0 and d[2] == 0):
    print(d[0])
else:
    print(0)


import sys
import math
  
n = int(sys.stdin.readline())
an = sys.stdin.readline()

d = [0] * 3

for i in range(n):
    if(an[i] == 'A'):
        d[0] += 1
    elif(an[i] == 'I'):
        d[2] += 1
   
if(d[2] == 1):
    print(d[2])
elif(d[0] != 0 and d[2] == 0):
    print(d[0])
else:
    print(0)


n = int(input())
c = {'A': 0, 'F': 0, 'I': 0}
for ch in input():
    c[ch] += 1
if c['I'] == 0:
    print(c['A'])
elif c['I'] == 1:
    print(1)
else:
    print(0)

from collections import Counter
n = int(input())
cnt = Counter(input())
if cnt['I']:
	if cnt['I'] == 1:
		print(1)
	else:
		print(0)
else:
	print(cnt['A'])


from collections import Counter


def main():
    input()
    cnt = Counter(input())
    if not cnt['I']:
        print(cnt['A'])
    elif cnt['I'] == 1:
        print('1')
    else:
        print('0')


def __starting_point():
    main()
__starting_point()

i=input;i();p=i();print([[1,0],[p.count("A")]][p.count("I")==0][p.count("I")>1])

n=int(input());s=input()
a=s.count('A');b=s.count('I')
print([a,[1,0][b!=1]][b!=0])

# coding: utf-8
from collections import Counter
n = int(input())
c = Counter(input())
if c['I'] > 1:
    print(0)
elif c['I'] == 1:
    print(1)
else:
    print(c['A'])


x = int(input())
s = input()
if s.count("I") >1:
    print(0)
elif s.count('I') == 0:
    print(s.count('A'))
else:
    print(1)


input()
s = input()
if s.count('I') > 1:
   print(0)
elif s.count('I') == 1:
   print(1)
else:
   print(s.count('A'));

n = int(input())
status = list(input())

allin = status.count("A")
folded = status.count("F")
In = status.count("I")

if In > 1:
	print(0)

if In == 1:
	print(1)

if In == 0:
	print(allin)

n = int(input())

status = list(input())

allin = status.count("A")
folded = status.count("F")
In = status.count("I")

if In > 1:
	print(0)

if In == 1:
	print(1)

if In == 0:
	print(allin)

from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading, sys

def main():
    n = int(input())
    s = input()
    a = s.count('A')
    i = s.count('I')
    ans = 0
    if i == 0:
        ans = a
    else:
        if i == 1:
            ans = 1
    print(ans)

def __starting_point():
    """sys.setrecursionlimit(400000)
    threading.stack_size(40960000)"""
    thread = threading.Thread(target=main)
    thread.start()
__starting_point()

a,f,ii,n,s=0,0,0,int(input()),str(input())
for i in range(n):
    if s[i]=='I':
        ii+=1
    if s[i]=='A':
        a+=1
    if s[i]=='F':
        f+=1
if ii>1:
    ii=0
print(a if s.find('I')==-1 else ii)

n=int(input())
s=input()
ic=s.count('I')
print(1 if ic==1 else 0 if ic>1 else s.count('A'))


a=int(input())
b=input()
if b.count('I')==0:
    print(b.count('A'))
elif b.count('I')==1:
    print(1)
else:
    print(0)