import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String s[] = new String[N]; s new String[N] N for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			s[i] = sc.next();
		} {
			s[i] = sc.next();
		} s[i] = sc.next() s[i] s i sc.next() sc.next sc for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		} {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		} String t = s[i].substring(0, 1); t s[i].substring(0, 1) s[i].substring s[i] s i 0 1 for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			} int j = 1; int j = 1; j 1 j < 10 j 10 j++ j++ j {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			} {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			} String temp = s[i].substring(j, j + 1); temp s[i].substring(j, j + 1) s[i].substring s[i] s i j j + 1 j 1 int c = 0; c 0 s[i] = t s[i] s i t Arrays.sort(s) Arrays.sort Arrays s boolean flag = false; flag false long cnt = 0; cnt 0 long ans = 0; ans 0 for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		} {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		} if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			} s[i].equals(s[i - 1]) s[i].equals s[i] s i s[i - 1] s i - 1 i 1 {
				cnt++;
				flag = true;
			} cnt++ cnt flag = true flag true {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			} if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				} flag {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				} cnt++ cnt long sum = 0; sum 0 if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					} cnt % 2 == 0 cnt % 2 cnt 2 0 {
						sum = cnt / 2 * (cnt - 1);
					} sum = cnt / 2 * (cnt - 1) sum cnt / 2 * (cnt - 1) cnt / 2 cnt 2 (cnt - 1) cnt 1 {
						sum = (cnt - 1) / 2 * cnt;
					} sum = (cnt - 1) / 2 * cnt sum (cnt - 1) / 2 * cnt (cnt - 1) / 2 (cnt - 1) cnt 1 2 cnt ans += sum ans sum flag = false flag false cnt = 0 cnt 0 if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		} flag {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		} cnt++ cnt long sum = cnt * (cnt - 1) / 2; sum cnt * (cnt - 1) / 2 cnt * (cnt - 1) cnt (cnt - 1) cnt 1 2 ans += sum ans sum System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
}
