import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	}

} 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> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	}

} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		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 List<String> strs = new ArrayList<String>(); strs new ArrayList<String>() long ans = 0; ans 0 for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		} int i= 0 ; int i= 0 ; i 0 i < n i n i++ i++ i {
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		} {
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		} char[] tmp = (sc.next()).toCharArray(); tmp (sc.next()).toCharArray() (sc.next()).toCharArray (sc.next()) sc.next sc Arrays.sort(tmp) Arrays.sort Arrays tmp String tmpstr = String.valueOf(tmp); tmpstr String.valueOf(tmp) String.valueOf String tmp strs.add(tmpstr) strs.add strs tmpstr Collections.sort(strs) Collections.sort Collections strs long cnt = 1; cnt 1 for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		} int i = 1 ; int i = 1 ; i 1 i < n i n i++ i++ i {
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		} {
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		} if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			} (strs.get(i-1)).equals(strs.get(i)) (strs.get(i-1)).equals (strs.get(i-1)) strs.get strs i-1 i 1 strs.get(i) strs.get strs i {
				cnt++;
			} cnt++ cnt {
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			} if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				} cnt == 1 cnt 1 {
				} {
					ans += cnt*(cnt-1)/2;
				} ans += cnt*(cnt-1)/2 ans cnt*(cnt-1)/2 cnt*(cnt-1) cnt (cnt-1) cnt 1 2 cnt=1 cnt 1 if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		} cnt == 1 cnt 1 {
		} {
			ans += cnt*(cnt-1)/2;
		} ans += cnt*(cnt-1)/2 ans cnt*(cnt-1)/2 cnt*(cnt-1) cnt (cnt-1) cnt 1 2 cnt=1 cnt 1 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)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	}

} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<String> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	}

} 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> strs = new ArrayList<String>();
		long ans = 0;

		for(int i= 0 ; i < n ; i++){
			char[] tmp = (sc.next()).toCharArray();
			Arrays.sort(tmp);
			String tmpstr = String.valueOf(tmp);
			strs.add(tmpstr);
		}
		Collections.sort(strs);
		long cnt = 1;
		for(int i = 1 ; i < n ; i++){
			if((strs.get(i-1)).equals(strs.get(i))){
				cnt++;
			}else{
				if(cnt == 1){
				}else{
					ans += cnt*(cnt-1)/2;
				}
				cnt=1;
			}
		}

		if(cnt == 1){
		}else{
			ans += cnt*(cnt-1)/2;
		}
		cnt=1;

		System.out.println(ans);
	}

}