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: EASY

Solutions:
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 sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
arr = is1()
if 'I' in arr:
	if arr.count('I') > 1:
		print(0)
	else:
		print(1)
else:
	print(arr.count('A'))


n = int(input())
s = input()
koli = 0
kola = 0
for i in range(n):
	if s[i] == 'I':
		koli += 1
	if s[i] == 'A':
		kola += 1
if koli > 1:
	print(0)
	exit()
if koli == 1:
	print(1)
	exit()
print(kola)


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def revn(n):
	m = 0
	while n > 0:
		m = m * 10 + n % 10
		n = n // 10
	return m
n = ii()
s = input()
cl = getdict(s)
keys = ['A', 'F', 'I']
for key in keys:
	if key not in cl:
		cl[key] = 0
if cl['I'] == 0:
	print(cl['A'])
elif cl['I'] == 1:
	print(1)
else:
	print(0)


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


a = int(input())
s = input()
b = {'A': 0, 'I': 0, 'F': 0}
for i in s:
	b[i] += 1
if b['I'] > 1:
	print(0)
elif b['I'] == 1:
	print(1)
else:
	print(b['A'])


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


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()
ic = s.count('I')
print(1 if ic == 1 else 0 if ic > 1 else s.count('A'))


nb_cows = int(input())
status = input()
icount = status.count('I')
if icount == 1:
	print(1)
elif icount > 1:
	print(0)
else:
	print(status.count('A'))


def solve():
	import sys
	f = sys.stdin
	n = int(f.readline())
	s = f.readline()
	if 'I' in s:
		if s.count('I') == 1:
			print(1)
		else:
			print(0)
	else:
		print(s.count('A'))
solve()


def main():
	n = int(input())
	status = input()
	num_I = status.count('I')
	if num_I == 1:
		print(1)
	elif num_I > 1:
		print(0)
	else:
		print(status.count('A'))
main()


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


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


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


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'])


from collections import Counter

def get_ans():
	n = input()
	c = Counter(input())
	a = c['A']
	f = c['F']
	i = c['I']
	if i != 0:
		if i != 1:
			return 0
		else:
			return 1
	if c['A'] != 0:
		return c['A']
	return 0
ans = get_ans()
print(ans)


n = int(input())
s = input()
c = 0
for i in s:
	if i == 'I':
		c += 1
	if c > 1:
		ans = 0
		break
if c == 0:
	ans = s.count('A')
elif c == 1:
	ans = 1
print(ans)


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


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf
from bisect import bisect_right, bisect_left
n = int(input())
s = input()
ans = 0
ii = s.count('I')
aa = s.count('A')
if ii > 1:
	print(0)
	exit()
elif ii == 0:
	print(aa)
else:
	print(1)


n = int(input())
s = input()
A = 0
I = 0
for i in range(n):
	if s[i] == 'A':
		A += 1
	elif s[i] == 'I':
		I += 1
if I == 1:
	print(I)
elif I > 1:
	print('0')
else:
	print(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)


from collections import Counter
t = int(input())
arr = list(input())
c = Counter(arr)
if c['I'] == 0:
	res = c['A']
elif c['I'] == 1:
	res = 1
else:
	res = 0
print(res)


a = int(input())
t = list(input())
if t.count('I') == 1:
	print(1)
elif t.count('I') == 0:
	print(a - t.count('F'))
else:
	print(0)


(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)


cows = int(input())
bets = input()
i = bets.count('I')
if i > 1:
	print(0)
elif i == 1:
	print(1)
else:
	print(bets.count('A'))


n = int(input())
s = input()
dic = {}
for x in s:
	if x in dic:
		dic[x] += 1
	else:
		dic[x] = 1
if 'I' not in dic:
	dic['I'] = 0
if 'A' not in dic:
	dic['A'] = 0
if 'F' not in dic:
	dic['F'] = 0
if dic['I'] == 0:
	print(dic['A'])
elif dic['I'] == 1 and (dic['A'] > 0 or dic['F'] > 0):
	print(dic['I'])
else:
	print(0)


n = int(input())
s = input()
a = 0
f = 0
j = 0
for i in s:
	if i == 'A':
		a = a + 1
	elif i == 'F':
		f = f + 1
	else:
		j = j + 1
z = 0
if a != 0 and j == 0:
	z = z + a
if j == 1:
	z = z + j
print(z)


import math
from collections import *
import sys
from functools import reduce
import time
from itertools import groupby

def input():
	return sys.stdin.readline()

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)]
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1), (+1, +1), (+1, +0), (+1, -1), (+0, +1)]
CAPS_ALPHABETS = {chr(i + ord('A')): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + ord('a')): i for i in range(26)}
INF = float('inf')
S34t = time.time()
input()
s = input()
d = Counter(s)
i = d.get('I', 0)
if i == 0:
	print(d.get('A', 0))
elif i == 1:
	print(1)
else:
	print(0)
S34p = time.time()


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)


import sys
f = sys.stdin

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())
c = input()
f = c.count('F')
a = c.count('A')
i = c.count('I')
if i > 1:
	print(0)
elif i == 1:
	print(1)
else:
	print(a)


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


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
	elif i == 1:
		ans = 1
	print(ans)

def __starting_point():
	thread = threading.Thread(target=main)
	thread.start()
__starting_point()


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


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


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()


from collections import Counter
n = int(input())
s = input()
c = Counter(s)
res = 0
for i in s:
	c[i] -= 1
	if i in 'AI':
		if c['I'] == 0:
			res += 1
	c[i] += 1
print(res)


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


n = int(input())
s = input()
arr = [0] * 3
c = 0
for i in range(0, n):
	if s[i] == 'A':
		arr[0] = arr[0] + 1
	if s[i] == 'F':
		arr[1] = arr[1] + 1
	if s[i] == 'I':
		arr[2] = arr[2] + 1
for i in range(0, n):
	if s[i] == 'A':
		if arr[2] == 0:
			c = c + 1
	if s[i] == 'I':
		if arr[2] - 1 == 0:
			c = c + 1
print(c)


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
tot = 0
n = int(input())
s = list(input())
c = Counter(s)
for i in s:
	if i == 'F':
		continue
	else:
		c[i] -= 1
		if c['I'] == 0:
			tot += 1
		c[i] += 1
print(tot)


A = int(input())
V = input()
F = 0
A = 0
I = 0
for i in range(len(V)):
	if V[i] == 'F':
		F += 1
	elif V[i] == 'A':
		A += 1
	else:
		I += 1
if I >= 2:
	print(0)
elif I:
	print(1)
elif A:
	print(A)
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'])


n = int(input())
a = input()
allin = 0
in1 = 0
fold = 0
for z in a:
	if z == 'A':
		allin += 1
	elif z == 'F':
		fold += 1
	else:
		in1 += 1
if in1 >= 2:
	print(0)
elif in1 == 1:
	print(1)
else:
	print(allin)


n = int(input())
s = input()
(a, f, i) = (s.count('A'), s.count('F'), s.count('I'))
if a + f == n:
	print(a)
elif a == n:
	print(a)
elif f == n or i == n:
	print(0)
elif i == 1:
	print(i)
elif i > 1:
	print(0)


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())
s = input()
tot = 0
curI = s.count('I')
curF = s.count('F')
curA = s.count('A')
for i in range(len(s)):
	if s[i] == 'I':
		if curF + curA == len(s) - 1:
			tot += 1
	if s[i] == 'A':
		if curF + curA - 1 == len(s) - 1:
			tot += 1
print(tot)


n = int(input())
a = [i for i in input()][:n]
j = 0
na = 0
ni = 0
nf = 0
for i in range(n):
	if a[i] == 'A':
		na = na + 1
	elif a[i] == 'I':
		ni = ni + 1
	else:
		nf = nf + 1
for i in range(n):
	if a[i] == 'A':
		if ni == 0:
			j = j + 1
	elif a[i] == 'I':
		if ni == 1:
			j = j + 1
	else:
		pass
print(j)


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


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	s = sys.stdin.readline().strip()
	print([s.count('A'), 1, 0][min(s.count('I'), 2)])
main()


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


import collections as cl
(n, s) = (input(), cl.Counter(input()))
print(int(s['I'] == 1) if 'I' in s.keys() else s['A'])


from collections import defaultdict
MyDict = defaultdict(int)
input()
for i in input():
	MyDict[i] += 1
print((0 if 'A' not in MyDict.keys() else MyDict['A']) if 'I' not in MyDict.keys() else 0 if MyDict['I'] != 1 else 1)


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, threading, os.path
import string
import collections, heapq, math, bisect
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def main():
	if os.path.exists('in.txt'):
		input = open('in.txt', 'r')
	else:
		input = sys.stdin
	n = int(input.readline())
	st = list(str(input.readline().rstrip('\n')))
	dict = {}
	for x in st:
		if x in dict:
			dict[x] += 1
		else:
			dict[x] = 1
	result = 0
	if 'I' in dict:
		if dict['I'] == 1:
			result = 1
		else:
			result = 0
	elif 'A' in dict:
		result = dict['A']
	else:
		result = 0
	output = result
	if os.path.exists('out.txt'):
		open('out.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


(n, s) = (int(input()), input())
(a, i) = (s.count('A'), s.count('I'))
f = n - (a + i)
if i == 1 and (f > 0 or a > 0):
	print(i)
elif i == 0 and a > 0:
	print(a)
else:
	print(0)


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


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)


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


n = int(input())
ent = input()
a = 0
f = 0
i = 0
for _ in range(0, len(ent)):
	if ent[_] == 'A':
		a += 1
	elif ent[_] == 'F':
		f += 1
	elif ent[_] == 'I':
		i += 1
if i == 0:
	print(a)
elif i >= 2:
	print('0')
else:
	print('1')


n = int(input())
adict = {}
adict['A'] = 0
adict['F'] = 0
adict['I'] = 0
s = input()
for a in s:
	if a == 'A':
		adict['A'] += 1
	elif a == 'F':
		adict['F'] += 1
	elif a == 'I':
		adict['I'] += 1
count = 0
if adict['I'] == 0:
	count += adict['A']
if adict['I'] == 1:
	count += adict['I']
print(count)


c = int(input())
s = input()
p = [i for i in s]
a = p.count('A')
i = p.count('I')
f = p.count('F')
if i == 0:
	print(a)
elif i == 1:
	print(i)
else:
	print(0)


S = int(input())
A = input()
As = A.count('A')
Fs = A.count('F')
Is = A.count('I')
ans = 0
if Is > 1:
	print(ans)
else:
	ans += Is
	if Is == 0:
		ans += As
	print(ans)


from collections import Counter
input()
s = Counter(input())
print([0, 1][s['I'] == 1] if 'I' in s.keys() else s['A'])


z = int(input())
a = i = 0
for k in input():
	if k == 'A':
		a += 1
	elif k == 'I':
		i += 1
if i > 1 or a + i == 0:
	print(0)
else:
	print(['%d' % i, '%d' % a][i == 0])


n = int(input())
s = input()
count = {}
for x in s:
	count[x] = count.get(x, 0) + 1
ans = 0
for x in s:
	if x in 'AI':
		count[x] -= 1
		if count.get('I', 0) == 0:
			ans += 1
		count[x] += 1
print(ans)


n = int(input())
a = list(input())
Is = 0
for i in range(len(a)):
	if a[i] == 'I':
		Is += 1
if Is >= 2:
	print(0)
elif Is == 1:
	print(1)
else:
	count = 0
	for i in range(len(a)):
		if a[i] == 'A':
			count += 1
	print(count)


from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline()
s = list(s)
if s.count('I') == 0:
	stdout.write(str(s.count('A')))
elif s.count('I') == 1:
	stdout.write('1')
else:
	stdout.write('0')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	n = ii()
	s = I().strip()
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	if len(d) > 2:
		if d['I'] == 1:
			print(1)
		else:
			print(0)
	elif d['I'] == 0:
		print(d['A'])
	elif d['I'] == 1:
		print(1)
	else:
		print(0)
main()


n = int(input())
x = input()
ans = 0
m = {'A': 0, 'I': 0, 'F': 0}
for i in x:
	m[i] += 1
for i in x:
	if i == 'A':
		if m['I'] == 0:
			ans += 1
	elif i == 'I':
		if m[i] == 1:
			ans += 1
print(ans)


input()
s = input()
x = s.count('I')
print(0 if x > 1 else s.count('A') if x < 1 else 1)


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


n = int(input())
s = str(input())
s = s.replace('F', '')
if s.count('I') >= 2:
	print(0)
elif s.count('I') == 1:
	print(1)
elif s.count('I') == 0:
	print(s.count('A'))


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


def poker_cow(n, seq):
	total = 0
	ref = {'A': 0, 'I': 0, 'F': 0}
	for x in seq:
		ref[x] += 1
	if ref['I'] == 0:
		return ref['A']
	elif ref['I'] == 1:
		return ref['I']
	else:
		return 0
n = int(input())
seq = input()
print(poker_cow(n, seq))


from sys import stdin, stdout
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as cmb, permutations as pmb
from math import factorial as f, ceil, gcd, sqrt, log, inf
mi = lambda : map(int, input().split())
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))
mati = lambda r: [li() for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)
MOD = 10 ** 9 + 7

def soe(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def ncr(n, r):
	(p, k) = (1, 1)
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			(p, k) = (p * n, k * r)
			m = gcd(p, k)
			(p, k) = (p // m, k // m)
			(n, r) = (n - 1, r - 1)
	else:
		p = 1
	return p

def solve():
	n = ii()
	s = input()
	if s.count('I') > 1:
		print(0)
	elif s.count('I') == 1:
		print(1)
	else:
		print(s.count('A'))
for _ in range(1):
	solve()


input()
s = input()
a = s.count('A')
i = s.count('I')
print([a, [1, 0][i != 1]][i != 0])


n = int(input())
a = str(input())
count = 0
if 'I' in a:
	if a.count('I') > 1:
		print(0)
	else:
		print(1)
else:
	for i in range(0, n):
		if a[i] == 'A':
			count += 1
	print(count)