	import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
}	 import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util import java.util.TreeMap; TreeMap java.util public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
} Main public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	} Main {
		// TODO 自動生成されたコンストラクター・スタブ
	} public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	} main {
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a; a String alpha="abcdefghijklmnopqrstuvwxyz"; alpha "abcdefghijklmnopqrstuvwxyz" Map <String,Integer> mapA = new TreeMap<String,Integer>(); mapA new TreeMap<String,Integer>() Map <String,Integer> mapB = new TreeMap<String,Integer>(); mapB new TreeMap<String,Integer>() Map <String,Integer> mapC = new HashMap<String,Integer>(); mapC new HashMap<String,Integer>() int n n index index index2 index2 index3 index3 count; count long answer answer count2; count2 String s s s2; s2 n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		} index=0; index=0 index 0 index<n index n index++ index++ index {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		} {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		} s = sc.next() s sc.next() sc.next sc mapA.clear() mapA.clear mapA for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			} index2=0; index2=0 index2 0 index2<10 index2 10 index2++ index2++ index2 {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			} {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			} s2=s.substring(index2,index2+1) s2 s.substring(index2,index2+1) s.substring s index2 index2+1 index2 1 if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				} mapA.containsKey(s2) mapA.containsKey mapA s2 {
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				} count=mapA.get(s2) count mapA.get(s2) mapA.get mapA s2 mapA.put(s2,count+1) mapA.put mapA s2 count+1 count 1 {
					mapA.put(s2,1);
				} mapA.put(s2,1) mapA.put mapA s2 1 s2="" s2 "" for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			} String s3 mapA.keySet() mapA.keySet mapA {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			} {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			} count=mapA.get(s3) count mapA.get(s3) mapA.get mapA s3 for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				} index3=0; index3=0 index3 0 index3<count index3 count index3++ index3++ index3 {
					s2=s2.concat(s3);
				} {
					s2=s2.concat(s3);
				} s2=s2.concat(s3) s2 s2.concat(s3) s2.concat s2 s3 if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			} mapB.containsKey(s2) mapB.containsKey mapB s2 {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			} count=mapB.get(s2) count mapB.get(s2) mapB.get mapB s2 mapB.put(s2,count+1) mapB.put mapB s2 count+1 count 1 {
				mapB.put(s2,1);
			} mapB.put(s2,1) mapB.put mapB s2 1 sc.close() sc.close sc answer=0 answer 0 for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		} String s4 mapB.keySet() mapB.keySet mapB {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		} {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		} count=mapB.get(s4) count mapB.get(s4) mapB.get mapB s4 if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			} count>1 count 1 {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			} count2=count count2 count count2=count2*(count2-1)/2 count2 count2*(count2-1)/2 count2*(count2-1) count2 (count2-1) count2 1 2 if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				} answer==0 answer 0 {
					answer=count2;
				} answer=count2 answer count2 {
					answer=answer+count2;
				} answer=answer+count2 answer answer+count2 answer count2 System.out.print(answer) System.out.print System.out System System.out answer String[] args args public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
} public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
} Main
	import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
}	