P11269 [AOJ] AOR-String
普及
题目描述

problem

Given $ N $ strings $ S_i $.

Find the maximum number of "AOR" in the string obtained by connecting $ S_i $ in any order.

output

Output the maximum number of "AOR" contained in the character string obtained by connecting $ S_i $ in any order. Also, output a line feed at the end.

Example

Input

2
AORA
OR

Output

2

输入格式

见题面

输出格式

见题面

样例输入
2 AORA OR
样例输出
2