P29515 [洛谷] [NWRRC2013] Arrangement of Contest
普及
题目描述

Problem Description

Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task proposals and now Dmitry and Petr want to select some of them for the contest. As they are just little boys, they cannot estimate the quality of tasks, but they know for sure that in a good contest, the title of the first problem starts with 'A', the title of the second one starts with 'B', and so on.

Given titles of the proposed tasks, help little brothers to determine the maximal number of problems in a good contest they can arrange.

Input Format

The first line contains a single integer $n$ — the number of problem proposals received by the little brothers $(1 \le n \le 100)$.

Next $n$ lines contain titles of proposed problems, one per line. The length of each title does not exceed 30 characters. Each title starts with an uppercase letter and contains only English letters, digits, and underscores.

Output Format

Output a single number — the maximal number of problems in a good contest. In case there is no good contest that may be arranged, output $0$.

Sample Input and Output

Sample Input #1

12
Arrangement_of_Contest
Ballot_Analyzing_Device
Correcting_Curiosity
Dwarf_Tower
Energy_Tycoon
Flight_Boarding_Optimization
Garage
Heavy_Chain_Clusterization
Intellectual_Property
J
Kids_in_a_Friendly_Class
Lonely_Mountain

Sample Output #1

12

Sample Input #2

3
Snow_White_and_the_7_Dwarfs
A_Problem
Another_Problem

Sample Output #2

1

Sample Input #3

2
Good_Problem
Better_Problem

Sample Output #3

0

Notes/Hints

Time limit: 2 seconds, Memory limit: 256 MB.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
12 Arrangement_of_Contest Ballot_Analyzing_Device Correcting_Curiosity Dwarf_Tower Energy_Tycoon Flight_Boarding_Optimization Garage Heavy_Chain_Clusterization Intellectual_Property J Kids_in_a_Friendly_Class Lonely_Mountain
样例输出
12