import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String sort = "";
		String[] anagram = new String[N];
		long count = 0;
		//文字列一つずつ並び替え
		for(int i = 0; i<N ; i++) {
			sort = sc.nextLine();
			String[] change = sort.split("");
			Arrays.sort(change);
			anagram[i] = String.join("",change);
		}
		//HashMapに一つずつ判定して入れる。重複があればカウント。
		HashMap<String,Long> checklist = new HashMap<>();
		for(int i = 0; i<N; i++) {
			if(checklist.containsKey(anagram[i])) {
				long value = checklist.get(anagram[i]);
				count+=value;
				checklist.put(anagram[i], value+1);
			}else {
				checklist.put(anagram[i],(long)1);
			}
		}
		System.out.println(count);
	}

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz