import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	} main {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<String> list_check=new ArrayList<String>(); list_check new ArrayList<String>() int n= sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		} int i=0; int i=0; i 0 n>i n i i++ i++ i {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		} {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		} String s = sc.next(); s sc.next() sc.next sc List<String> list= new ArrayList<String>(Arrays.asList(s.split(""))); list new ArrayList<String>(Arrays.asList(s.split(""))) Collections.sort(list) Collections.sort Collections list String check =""; check "" for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			} int j=0; int j=0; j 0 list.size()>j list.size() list.size list j j++ j++ j {
				check=check+list.get(j);
			} {
				check=check+list.get(j);
			} check=check+list.get(j) check check+list.get(j) check list.get(j) list.get list j list_check.add(check) list_check.add list_check check long answer=0; answer 0 Collections.sort(list_check) Collections.sort Collections list_check for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		} int i=0; int i=0; i 0 list_check.size()>i list_check.size() list_check.size list_check i i++ i++ i {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		} {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		} int count=0; count 0 for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			} int j=i+1; int j=i+1; j i+1 i 1 list_check.size()>j list_check.size() list_check.size list_check j j++ j++ j {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			} {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			} if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break; list_check.get(i).equals(list_check.get(j)) list_check.get(i).equals list_check.get(i) list_check.get list_check i list_check.get(j) list_check.get list_check j {
					count++;
					answer=answer+count;
				} count++ count answer=answer+count answer answer+count answer count break; i=i+count i i+count i count System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		List<String> list_check=new ArrayList<String>();
		int n= sc.nextInt();
		for(int i=0;n>i;i++) {
			String s = sc.next();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			Collections.sort(list);
			String check ="";
			for(int j=0;list.size()>j;j++) {
				check=check+list.get(j);
			}
			list_check.add(check);
		}
		long answer=0;
		Collections.sort(list_check);
		//System.out.println(list_check);
		for(int i=0;list_check.size()>i;i++) {
			int count=0;
			for(int j=i+1;list_check.size()>j;j++) {
				if(list_check.get(i).equals(list_check.get(j))) {
					count++;
					answer=answer+count;
				}
				else
					break;
			}
			i=i+count;
		}
		System.out.println(answer);
	}
}