// Arup Guha
// 10/13/2015
// Solution to 2005 UCF HS Contst Problem: Lice N-Plates

import java.util.*;

public class lice {

	final public static String CONSONANTS = "bcdfghjklmnpqrstvwxz";
	final public static String VOWELS = "aeiou";

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int loop = 1;

		// Process each case
		while (n != 0) {

			// Add in each code to a Hash Set.
			HashSet<Integer> set = new HashSet<Integer>();
			for (int i=0; i<n; i++)
				set.add(code(stdin.next()));

			// Output result and get next case.
			System.out.println("The lice in data set #"+loop+" came from "+set.size()+" different head(s).");
			n = stdin.nextInt();
			loop++;
		}
	}

	// Returns the code for this plate.
	public static int code(String plate) {

		int res = 0;

		// Go through each character backwards.
		for (int i=plate.length()-1; i>=0; i--) {

			// Always add just hte first one.
			res += score(plate, i);

			// Double count if we need to.
			if (i < plate.length()-1 && type(plate.charAt(i)) == type(plate.charAt(i+1)))
				res += score(plate, i+1);
		}

		return res;
	}

	// Returns the score of character at index in plate.
	public static int score(String plate, int index) {

		plate = plate.toLowerCase();

		// Digit rule
		char c = plate.charAt(index);
		if (Character.isDigit(c)) return (int)(c-'0');

		// Vowel/Consonant rules
		if (VOWELS.contains(""+c)) return 15;
		if (CONSONANTS.contains(""+c)) return 10;

		// Must be a y...check both sides.
		if (index > 0 && CONSONANTS.contains(""+plate.charAt(index-1))) return 15;
		if (index < plate.length()-1 && CONSONANTS.contains(""+plate.charAt(index+1))) return 15;

		// Must be a y next to no consonants.
		return 10;
	}

	// Returns the type of character for c, assuming it's a letter(0) or digit(1).
	public static int type(char c) {
		if (Character.isLetter(c)) return 0;
		if (Character.isDigit(c)) return 1;
		return 2;
	}
}