// Arup Guha
// 1/18/2024
// Second Alternate Solution to 2018 UCF Locals Problem: SGA President
// Illustrates that only one map is needed.

import java.util.*;

public class sga3 {

	public static int n;
	public static HashMap<String,Integer> map;
	public static long[] sizes;

	public static void main(String[] args) {

		// Note: I am using a Scanner because I want our run-times to allow for newcomers to solve this problem
		//       without using a FastScanner/BufferedReader.
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		
		// Set up my HashMaps.
		map = new HashMap<String,Integer>();
		sizes = new long[26];
			
		// Read in all the names in to the appropriate HashMaps.	
		for (int i=0; i<n; i++) {
			
			// Get the name and first letter, marking how many names start with that letter.
			String name = stdin.next();
			int idx = name.charAt(0)-'A';
			sizes[idx]++;
			
			// Place in the appropriate hash map how many of this name we've seen.
			if (map.containsKey(name))
				map.put(name, (map.get(name))+1);
			else
				map.put(name, 1);
		}
		
		long res = 0;
		 
		// Count up the result.
		for (String s: map.keySet()) {
			int freq = map.get(s);
			res = res + ((long)freq)*(sizes[s.charAt(0)-'A']-freq);
		}
		
		// Ta da!
		System.out.println(res);
	}
}