import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	}

	public boolean hasNext() {
		return cnt < N;
	}

	HashMap<String, Integer> Ana;
	int[] Hist;

	public void readBody(String str) {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	}

	public void solve() {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashMap; HashMap java.util class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) Solver solver = new Solver(); solver new Solver() solver.init() solver.init solver solver.readHead(in.readLine()) solver.readHead solver in.readLine() in.readLine in for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		} ; solver.hasNext() solver.hasNext solver {
			solver.readBody(in.readLine());
		} {
			solver.readBody(in.readLine());
		} solver.readBody(in.readLine()) solver.readBody solver in.readLine() in.readLine in solver.solve() solver.solve solver String args[] args class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	}

	public boolean hasNext() {
		return cnt < N;
	}

	HashMap<String, Integer> Ana;
	int[] Hist;

	public void readBody(String str) {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	}

	public void solve() {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	}
} Solver int N; N int cnt; cnt HashMap<String, Integer> Ana; Ana int[] Hist; Hist public void init() {
		N = 0;
		cnt = 0;
	} init {
		N = 0;
		cnt = 0;
	} N = 0 N 0 cnt = 0 cnt 0 public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	} readHead {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	} String[] strArr = str.split("\\s+"); strArr str.split("\\s+") str.split str "\\s+" N = Integer.parseInt(strArr[0]) N Integer.parseInt(strArr[0]) Integer.parseInt Integer strArr[0] strArr 0 Ana = new HashMap<String, Integer>() Ana new HashMap<String, Integer>() Hist = new int[26] Hist new int[26] 26 String str str public boolean hasNext() {
		return cnt < N;
	} hasNext {
		return cnt < N;
	} return cnt < N; cnt < N cnt N public void readBody(String str) {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	} readBody {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	} for (int i = 0; i < 26; i++)
			Hist[i] = 0; int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i Hist[i] = 0; Hist[i] = 0 Hist[i] Hist i 0 for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++; int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i Hist[str.charAt(i) - 'a']++; Hist[str.charAt(i) - 'a']++ Hist[str.charAt(i) - 'a'] Hist str.charAt(i) - 'a' str.charAt(i) str.charAt str i 'a' String key = ""; key "" for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		} int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		} {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		} if (Hist[i] == 0)
				continue; Hist[i] == 0 Hist[i] Hist i 0 continue; char c = (char) ('a' + i); c (char) ('a' + i) 'a' i key = key + c + Hist[i] key key + c + Hist[i] key + c + Hist[i] key c Hist[i] Hist i if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1); !Ana.containsKey(key) Ana.containsKey(key) Ana.containsKey Ana key Ana.put(key, 1) Ana.put Ana key 1 Ana.put(key, Ana.get(key) + 1) Ana.put Ana key Ana.get(key) + 1 Ana.get(key) Ana.get Ana key 1 cnt++ cnt String str str public void solve() {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	} solve {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	} long ans = 0; ans 0 for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		} String key Ana.keySet() Ana.keySet Ana {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		} {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		} if (Ana.get(key) < 2)
				continue; Ana.get(key) < 2 Ana.get(key) Ana.get Ana key 2 continue; long n = Ana.get(key); n Ana.get(key) Ana.get Ana key ans += (n * (n - 1) / 2) ans (n * (n - 1) / 2) n * (n - 1) n (n - 1) n 1 2 System.out.println(ans) System.out.println System.out System System.out ans
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	}

	public boolean hasNext() {
		return cnt < N;
	}

	HashMap<String, Integer> Ana;
	int[] Hist;

	public void readBody(String str) {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	}

	public void solve() {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	}
}
