/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
} Main public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    } main {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    } FastScanner sc = new FastScanner(System.in); sc new FastScanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc HashMap<String, Integer> seen = new HashMap<>(); seen new HashMap<>() long total = 0; total 0 for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        } {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        } String s = sc.next(); s sc.next() sc.next sc int[] cts = new int[26]; cts new int[26] 26 for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            } char c s.toCharArray() s.toCharArray s {
                cts[c - 'a']++;
            } {
                cts[c - 'a']++;
            } cts[c - 'a']++ cts[c - 'a'] cts c - 'a' c 'a' StringBuilder hash = new StringBuilder(); hash new StringBuilder() for (int val : cts) {
                hash.append(val + "_");
            } int val cts {
                hash.append(val + "_");
            } {
                hash.append(val + "_");
            } hash.append(val + "_") hash.append hash val + "_" val "_" String key = hash.toString(); key hash.toString() hash.toString hash if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            } seen.containsKey(key) seen.containsKey seen key {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            } total += seen.get(key) total seen.get(key) seen.get seen key seen.put(key, seen.get(key) + 1) seen.put seen key seen.get(key) + 1 seen.get(key) seen.get seen key 1 {
                seen.put(key, 1);
            } seen.put(key, 1) seen.put seen key 1 out.println(total) out.println out total out.close() out.close out String args[] args static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    } FastScanner BufferedReader br; br StringTokenizer st; st FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        } FastScanner {
            br = new BufferedReader(new InputStreamReader(s));
        } br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s FastScanner(FileReader s) {
            br = new BufferedReader(s);
        } FastScanner {
            br = new BufferedReader(s);
        } br = new BufferedReader(s) br new BufferedReader(s) FileReader s s String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st String nextLine() throws IOException { return br.readLine(); } nextLine { return br.readLine(); } return br.readLine(); br.readLine() br.readLine br double nextDouble() throws IOException { return Double.parseDouble(next()); } nextDouble { return Double.parseDouble(next()); } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next int nextInt() throws IOException { return Integer.parseInt(next()); } nextInt { return Integer.parseInt(next()); } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() throws IOException { return Long.parseLong(next()); } nextLong { return Long.parseLong(next()); } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
} public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
} Main
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        HashMap<String, Integer> seen = new HashMap<>();
        long total = 0;
        for (int i = 0; i < N; i++) {
            String s = sc.next();
            int[] cts = new int[26];
            for (char c : s.toCharArray()) {
                cts[c - 'a']++;
            }
            StringBuilder hash = new StringBuilder();
            for (int val : cts) {
                hash.append(val + "_");
            }
            String key = hash.toString();
            if (seen.containsKey(key)) {
                total += seen.get(key);
                seen.put(key, seen.get(key) + 1);
            }
            else {
                seen.put(key, 1);
            }
        }
        out.println(total);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

        int nextInt() throws IOException { return Integer.parseInt(next()); }

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
}