SGA President
Time limit1sMemory limit1024 MB
- Level
Not classified yet
- Solved
- No attempts yet
Statement
Timothy and Alex are no longer eligible for ICPC, so they want to run for SGA President and Vice President. Past winning tickets such as Josh/Jad and Brad/Breon each had two distinct names that start with the same first letter. Timothy and Alex do not fit that pattern, so they cannot win.
Given the first name of every UCF student, count the President/Vice President pairs that could win. A pair is possible when the two names are different and start with the same letter. The first name in the pair is the President candidate and the second is the Vice President candidate, so Josh/Jad and Jad/Josh count separately. Students may share a first name. If there are 10 Joshes and 3 Jads, there are 30 Josh/Jad pairs, and all of them count.
Input
The first line contains a single positive integer , the number of UCF students. Each of the next lines contains the first name of one student. Names consist only of uppercase letters and are between 1 and 20 letters long. Each line is a distinct student, and different students may have the same first name.
Output
Print the number of President/Vice President pairs that have a chance to win the SGA election, on a line by itself.