Io and Ao are playing a word game. They alternately
say words consisting of vowels only so that the first letter of every new word
is the same as the last letter of the previous word. A game can start with any
It is forbidden to say any word twice. Only words from given dictionary can be used in a game.
A complexity of a game is defined as a sum of lengths of all the spoken words during the game.
Write a program that will determine the maximal possible complexity of a game that can be played using words from a given dictionary.
The first line of input file contains a natural number N, 1 <=N <=16, the numbers of words in a dictionary. Each of next N lines contains one word from a dictionary. A word is a sequence of characters 'A', 'E', 'I', 'O' and 'U'. Length of every word will be 100 or less. All the words will be different.
The first and only line of output file should contain the maximal possible complexity of the game.