import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc Map<String,Integer> mp = new HashMap<String,Integer>(); mp new HashMap<String,Integer>() long ans=0; ans 0 for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		} {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		} char c[]=sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c) Arrays.sort Arrays c String s=String.valueOf(c); s String.valueOf(c) String.valueOf String c if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			} !mp.containsKey(s) mp.containsKey(s) mp.containsKey mp s {
				mp.put(s,0);
			} mp.put(s,0) mp.put mp s 0 {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			} int num=mp.get(s)+1; num mp.get(s)+1 mp.get(s) mp.get mp s 1 ans+=num ans num mp.put(s, num) mp.put mp s num 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) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Map<String,Integer> mp = new HashMap<String,Integer>();
		long ans=0;
		for(int i=0;i<n;i++) {
			char c[]=sc.next().toCharArray();
			Arrays.sort(c);
			String s=String.valueOf(c);
			if(!mp.containsKey(s)) {
				mp.put(s,0);
			}else {
				int num=mp.get(s)+1;
				ans+=num;
				mp.put(s, num);
			}
		}
		System.out.println(ans);
	}

}