import java.util.*;
public class Main{
	static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	}
	
	static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	}
	
	static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main{
	static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	}
	
	static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	}
	
	static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	}
} Main static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	} StrToNum {
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	} switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		} s case "a": "a" case "a": return 1; 1 case "b": "b" case "b": return 2; 2 case "c": "c" case "c": return 3; 3 case "d": "d" case "d": return 4; 4 case "e": "e" case "e": return 5; 5 case "f": "f" case "f": return 6; 6 case "g": "g" case "g": return 7; 7 case "h": "h" case "h": return 8; 8 case "i": "i" case "i": return 9; 9 case "j": "j" case "j": return 10; 10 case "k": "k" case "k": return 11; 11 case "l": "l" case "l": return 12; 12 case "m": "m" case "m": return 13; 13 case "n": "n" case "n": return 14; 14 case "o": "o" case "o": return 15; 15 case "p": "p" case "p": return 16; 16 case "q": "q" case "q": return 17; 17 case "r": "r" case "r": return 18; 18 case "s": "s" case "s": return 19; 19 case "t": "t" case "t": return 20; 20 case "u": "u" case "u": return 21; 21 case "v": "v" case "v": return 22; 22 case "w": "w" case "w": return 23; 23 case "x": "x" case "x": return 24; 24 case "y": "y" case "y": return 25; 25 case "z": "z" case "z": return 26; 26 return 0; 0 String s s static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	} ListCompare {
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	} for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		} int i=0; int i=0; i 0 i<l1.length i l1.length l1 l1.length i++ i++ i {
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		} {
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		} if(i >= l2.length){
				return 1;
			} i >= l2.length i l2.length l2 l2.length {
				return 1;
			} return 1; 1 if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			} l1[i] > l2[i] l1[i] l1 i l2[i] l2 i {
				return 1;
			} return 1; 1 if(l1[i] < l2[i]){
				return -1;
			} l1[i] < l2[i] l1[i] l1 i l2[i] l2 i {
				return -1;
			} return -1; -1 1 if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		} l2.length > l1.length l2.length l2 l2.length l1.length l1 l1.length {
			return -1;
		} return -1; -1 1 {
			return 0;
		} return 0; 0 int[] l1 l1 int[] l2 l2 static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	} quick_sort {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	} if(left>=right){
				return;
		} left>=right left right {
				return;
		} return; int[] p = d[(left+right)/2]; p d[(left+right)/2] d (left+right)/2 (left+right) left right 2 int l = left l left r = right; r right int[] tmp = new int[p.length]; tmp new int[p.length] p.length p p.length while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		} l<=r l r {
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		} while(ListCompare(d[l], p) > 0){ l++; } ListCompare(d[l], p) > 0 ListCompare(d[l], p) ListCompare d[l] d l p 0 { l++; } l++ l while(ListCompare(d[r], p) < 0){ r--; } ListCompare(d[r], p) < 0 ListCompare(d[r], p) ListCompare d[r] d r p 0 { r--; } r-- r if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			} l<=r l r {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			} tmp = d[l] tmp d[l] d l d[l] = d[r] d[l] d l d[r] d r d[r] = tmp d[r] d r tmp l++ l r-- r quick_sort(d, left, r) quick_sort d left r quick_sort(d, l, right) quick_sort d l right int[][] d d int left left int right right public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	} main {
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	} long ans = 0; ans 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] sp = new int[n][26]; sp new int[n][26] n 26 for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		} {
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		} for(int l=0; l<26; l++){
				sp[i][l] = 0;
			} int l=0; int l=0; l 0 l<26 l 26 l++ l++ l {
				sp[i][l] = 0;
			} {
				sp[i][l] = 0;
			} sp[i][l] = 0 sp[i][l] sp[i] sp i l 0 String s = sc.next(); s sc.next() sc.next sc String[] ssp = s.split(""); ssp s.split("") s.split s "" for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			} int j=0; int j=0; j 0 j<ssp.length j ssp.length ssp ssp.length j++ j++ j {
				sp[i][StrToNum(ssp[j])-1]++;
			} {
				sp[i][StrToNum(ssp[j])-1]++;
			} sp[i][StrToNum(ssp[j])-1]++ sp[i][StrToNum(ssp[j])-1] sp[i] sp i StrToNum(ssp[j])-1 StrToNum(ssp[j]) StrToNum ssp[j] ssp j 1 quick_sort(sp, 0, n-1) quick_sort sp 0 n-1 n 1 int j = 0; j 0 while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		} j < n-1 j n-1 n 1 {
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		} int rep = 1; rep 1 int k = j+1; k j+1 j 1 while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			} ListCompare(sp[k], sp[j]) == 0 ListCompare(sp[k], sp[j]) ListCompare sp[k] sp k sp[j] sp j 0 {
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			} ans += rep ans rep rep++ rep k++ k if(k >= sp.length){
					break;
				} k >= sp.length k sp.length sp sp.length {
					break;
				} break; j = k j k System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	}
	
	static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	}
	
	static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	}
} public class Main{
	static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	}
	
	static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	}
	
	static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main{
	static int StrToNum(String s){
		switch(s){
			case "a":
				return 1;
			case "b":
				return 2;
			case "c":
				return 3;
			case "d":
				return 4;
			case "e":
				return 5;
			case "f":
				return 6;
			case "g":
				return 7;
			case "h":
				return 8;
			case "i":
				return 9;
			case "j":
				return 10;
			case "k":
				return 11;
			case "l":
				return 12;
			case "m":
				return 13;
			case "n":
				return 14;
			case "o":
				return 15;
			case "p":
				return 16;
			case "q":
				return 17;
			case "r":
				return 18;
			case "s":
				return 19;
			case "t":
				return 20;
			case "u":
				return 21;
			case "v":
				return 22;
			case "w":
				return 23;
			case "x":
				return 24;
			case "y":
				return 25;
			case "z":
				return 26;
		}
		return 0;
	}
	
	static int ListCompare(int[] l1, int[] l2){
		for(int i=0; i<l1.length; i++){
			if(i >= l2.length){
				return 1;
			}
			if(l1[i] > l2[i]){
				return 1;
			}else if(l1[i] < l2[i]){
				return -1;
			}
		}
		if(l2.length > l1.length){
			return -1;
		}else{
			return 0;
		}
	}
	
	static void quick_sort(int[][] d, int left, int right) {
		if(left>=right){
				return;
		}
		int[] p = d[(left+right)/2];
		int l = left, r = right;
		int[] tmp = new int[p.length];
		while(l<=r){
			while(ListCompare(d[l], p) > 0){ l++; }
			while(ListCompare(d[r], p) < 0){ r--; }
			if (l<=r) {
				tmp = d[l]; d[l] = d[r]; d[r] = tmp;
				l++;
				r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] sp = new int[n][26];
		for(int i=0; i<n; i++){
			for(int l=0; l<26; l++){
				sp[i][l] = 0;
			}
			String s = sc.next();
			String[] ssp = s.split("");
			for(int j=0; j<ssp.length; j++){
				sp[i][StrToNum(ssp[j])-1]++;
			}
		}
		
		quick_sort(sp, 0, n-1);
		
		int j = 0;
		while(j < n-1){
			int rep = 1;
			int k = j+1;
			while(ListCompare(sp[k], sp[j]) == 0){
				ans += rep;
				rep++;
				k++;
				if(k >= sp.length){
					break;
				}
			}
			j = k;
		}
		
		System.out.println(ans);
	}
}
