In Aramic language words can only represent objects.

Words in Aramic have special properties: 

  * A word is a root if it does not contain the same letter more than once. 
  * A root and all its permutations represent the same object. 
  * The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab". 
  * Any word in Aramic represents the same object as its root. 



You have an ancient script in Aramic. What is the number of different objects mentioned in the script?

Input

The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.

The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.

It is guaranteed that all characters of the strings are small latin letters.

Output

Output one integer — the number of different objects mentioned in the given ancient Aramic script.

Examples

Input

5
a aa aaa ab abb


Output

2

Input

3
amer arem mrea


Output

1

Note

In the first test, there are two objects mentioned. The roots that represent them are "a","ab".

In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;

public class Main {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        solveA();
    }

    long gcd(long a, long b) {
        while (a != 0 && b != 0) {
            if (a > b)
                a %= b;
            else
                b %= a;
        }
        return a + b;
    }

    class Pair implements Comparable<Pair> {
        long a, b;

        Pair(long aa, long bb) {
            a = aa;
            b = bb;
            long gcd = gcd(abs(a), abs(b));
            a /= gcd;
            b /= gcd;
            if (b < 0) {
                b = -b;
                a = -a;
            }
        }

        @Override
        public int compareTo(Pair o) {
            return a == o.a ? Long.compare(b, o.b) : Long.compare(a, o.a);
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair pair = (Pair) o;

            return a == pair.a && b == pair.b;
        }
    }

    private void solveD() throws IOException {
        int n = in.nextInt();
        long a = in.nextLong(), b = in.nextLong();
        long[] x = new long[n], y = new long[n];
        long[] vx = new long[n], vy = new long[n];
        long[] A = new long[n], B = new long[n], C = new long[n];
        Pair[] p = new Pair[n];

        for (int i = 0; i < n; i++) {
            x[i] = in.nextLong();
            y[i] = a * x[i] + b;
            vx[i] = in.nextLong();
            vy[i] = in.nextLong();
            A[i] = -vy[i];
            B[i] = vx[i];
            C[i] = -A[i] * x[i] - B[i] * y[i];
            p[i] = new Pair(A[i], B[i]);
        }

        long ans = 0;
        TreeMap<Pair, Integer> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            ans += i - map.getOrDefault(p[i], 0);
            map.put(p[i], map.getOrDefault(p[i], 0) + 1);
        }

        out.println(ans);
    }

    private void solveC() throws IOException {
        int n = in.nextInt(), q = in.nextInt();
        long[] a = new long[n], b = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
            b[i] = a[i];
            if (i > 0)
                b[i] += b[i - 1];
        }
        long[] k = new long[q];
        for (int i = 0; i < q; i++) {
            k[i] = in.nextLong();
        }
        int id = 0;
        long minus2 = 0;
        for (int i = 0; i < q; i++) {
            long minus = (id == 0) ? 0 : b[id - 1];
            int l = id, r = n;
            while (l + 1 < r) {
                int mid = (l + r) / 2;
                if (b[mid] - minus - minus2 > k[i]) {
                    r = mid;
                } else {
                    l = mid;
                }
            }
            if (b[l] - minus - minus2 > k[i]) {
                id = l;
                minus2 = a[l] - (b[l] - minus - minus2 - k[i]);
            } else {
                id = r;
                if (id == n) {
                    id = 0;
                    minus2 = 0;
                } else
                    minus2 = a[r] - (b[r] - minus - minus2 - k[i]);
            }
            out.println(n - id);
        }
    }

    private void solveB() throws IOException {
        int n = 14;
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }
        long max = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] > 0) {
                long cur = 0, pr = a[i] % n;
                if ((a[i] / n) % 2 == 0) {
                    cur += (a[i] / n);
                }
                for (int j = 1; j < n; j++) {
                    int id = (i + j) % n;
                    int add = j <= pr ? 1 : 0;
                    if ((a[id] + a[i] / n + add) % 2 == 0) {
                        cur += (a[id] + a[i] / n + add);
                    }
                }
                max = max(max, cur);
            }
        }
        out.println(max);
    }

    private void solveA() throws IOException {
        int n = in.nextInt();
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            int d = 0;
            for (char c : in.next().toCharArray()) {
                d |= 1 << (c - 'a');
            }
            set.add(d);
        }
        out.println(set.size());
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

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

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

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

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

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

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

        boolean hasNextLine() throws IOException {
            return br.ready();
        }

    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}
