import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		} {
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		} String str = sc.next(); str sc.next() sc.next sc char[] chars = str.toCharArray(); chars str.toCharArray() str.toCharArray str Arrays.sort(chars) Arrays.sort Arrays chars String sortedStr = new String(chars); sortedStr new String(chars) list.add(sortedStr) list.add list sortedStr Collections.sort(list) Collections.sort Collections list String tmp = list.get(0); tmp list.get(0) list.get list 0 long sum = 0; sum 0 long count = 1; count 1 for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		} {
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		} if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} tmp.equals(list.get(i)) tmp.equals tmp list.get(i) list.get list i {
				sum += count++;
			} sum += count++ sum count++ count {
				count = 1;
			} count = 1 count 1 tmp = list.get(i) tmp list.get(i) list.get list i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
}