One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of n passwords — strings, consists of small Latin letters.

Hacker went home and started preparing to hack AtForces. He found that the system contains only passwords from the stolen list and that the system determines the equivalence of the passwords a and b as follows:

  * two passwords a and b are equivalent if there is a letter, that exists in both a and b; 
  * two passwords a and b are equivalent if there is a password c from the list, which is equivalent to both a and b. 



If a password is set in the system and an equivalent one is applied to access the system, then the user is accessed into the system.

For example, if the list contain passwords "a", "b", "ab", "d", then passwords "a", "b", "ab" are equivalent to each other, but the password "d" is not equivalent to any other password from list. In other words, if:

  * admin's password is "b", then you can access to system by using any of this passwords: "a", "b", "ab"; 
  * admin's password is "d", then you can access to system by using only "d". 



Only one password from the list is the admin's password from the testing system. Help hacker to calculate the minimal number of passwords, required to guaranteed access to the system. Keep in mind that the hacker does not know which password is set in the system.

Input

The first line contain integer n (1 ≤ n ≤ 2 ⋅ 10^5) — number of passwords in the list. Next n lines contains passwords from the list – non-empty strings s_i, with length at most 50 letters. Some of the passwords may be equal.

It is guaranteed that the total length of all passwords does not exceed 10^6 letters. All of them consist only of lowercase Latin letters.

Output

In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.

Examples

Input


4
a
b
ab
d


Output


2

Input


3
ab
bc
abc


Output


1

Input


1
codeforces


Output


1

Note

In the second example hacker need to use any of the passwords to access the system.
import java.io.*;
import java.util.*;

public class d {
    public static class DisjointSet {
        private int[] rank, parent;
        private int n;

        public DisjointSet(int n)
        {
            rank = new int[n];
            parent = new int[n];
            this.n = n;
            makeSet();
        }

        void makeSet()
        {
            for (int i = 0; i < n; i++) {
                parent[i] = i;
            }
        }

        int find(int i)
        {
            if (parent[i] != i) {
                parent[i] = find(parent[i]);
            }
            return parent[i];
        }

        void union(int x, int y)
        {
            int xRoot = find(x), yRoot = find(y);

            if (xRoot == yRoot) {
                return;
            }
            if (rank[xRoot] < rank[yRoot]) {
                parent[xRoot] = yRoot;
            } else if (rank[yRoot] < rank[xRoot]) {
                parent[yRoot] = xRoot;
            } else {
                parent[yRoot] = xRoot;
                rank[xRoot] = rank[xRoot] + 1;
            }
        }
    }

    public static void main(String[] args) throws Exception {
        R in = new R();
        int n = in.nextInt();
        char[][] strings = in.next2Dchar(n);

        DisjointSet set = new DisjointSet(n);
        ArrayList<HashSet<Integer>> indicesWithLetter = new ArrayList<>();
        // 0-25

        for (int i = 0; i < 26; i++) {
            indicesWithLetter.add(new HashSet<>());
        }

        for (int i = 0; i < strings.length; i++) {
            for (char c : strings[i]) {
                c-='a';
                indicesWithLetter.get(c).add(i);
            }
        }
        for (int i = 0; i < 26; i++) {
            Integer firstVal=null;
            for (Integer val : indicesWithLetter.get(i)) {
                if (firstVal==null) {
                    firstVal = val;
                    continue;
                }
                set.union(firstVal,val);
            }
        }
        HashSet<Integer> countSets = new HashSet<>();
        for (int i = 0; i < n; i++) {
            countSets.add(set.find(i));
        }
        System.out.println(countSets.size());
    }
    //<editor-fold desc="R">

    /**
     * This class is for fast input. Please ignore.
     */
    public static class R {
        private BufferedReader br;
        /**
         * Should be set to null at end of line
         */
        private StringTokenizer st;

        public R() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public R(String filename) throws IOException {
            br = new BufferedReader(new FileReader(filename + ".in"));
        }

        public R(BufferedReader reader) {
            br = reader;
        }

        public BufferedReader getReader() {
            return br;
        }

        public StringTokenizer getStringTokenizer() {
            return st;
        }

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

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

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

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

        /**
         * Note:
         * CAN MODIFY the BufferedReader's location and the string tokenizer!!!
         * Recommended to only use with next().
         */
        public boolean lineHasNext() throws IOException {
            if (st == null) {
                String s = br.readLine();
                if (s == null) return false;
                st = new StringTokenizer(s);
            }
            return st.hasMoreTokens();
        }

        /**
         * Note:
         * CAN MODIFY the BufferedReader's location and the string tokenizer!!!
         * Recommended to only use with next().
         */
        public boolean hasNext() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        /**
         * Skips a line. Sets st to null if has tokens left, and otherwise
         * reads a line.
         */
        public void skipLine() throws IOException {
            if (st == null || !st.hasMoreTokens()) {
                br.readLine(); // Otherwise, would do nothing.
            }
            st = null;
        }

        /**
         * This will set st to null, and this ignores current line
         */
        public String[] nextLine() throws IOException {
            String s = br.readLine();
            if (s == null) return null;
            st = new StringTokenizer(s);
            ArrayList<String> result = new ArrayList<>();
            while (st.hasMoreTokens()) {
                result.add(st.nextToken());
            }
            st = null;
            return result.toArray(new String[0]);
        }

        /**
         * sets st to null!
         */
        public String[] nextTower(int lines) throws IOException {
            String[] tower = new String[lines];
            st = null;
            for (int i = 0; i < lines; i++) {
                tower[i] = br.readLine();
            }
            return tower;
        }

        public int[] nextIntLine() throws IOException {
            return intArr(nextLine());
        }

        public long[] nextLongLine() throws IOException {
            return longArr(nextLine());
        }

        public int[] nextIntTower(int lines) throws IOException {
            return intArr(nextTower(lines));
        }

        public long[] nextLongTower(int lines) throws IOException {
            return longArr(nextTower(lines));
        }

        public int[] intArr(String[] strings) throws IOException {
            int[] ints = new int[strings.length];
            int i = 0;
            for (String s : strings) {
                ints[i] = Integer.parseInt(s);
                i++;
            }
            return ints;
        }

        public long[] longArr(String[] strings) throws IOException {
            long[] longs = new long[strings.length];
            int i = 0;
            for (String s : strings) {
                longs[i] = Long.parseLong(s);
                i++;
            }
            return longs;
        }

        public double[] doubleArr(String[] strings) {
            double[] doubles = new double[strings.length];
            int i = 0;
            for (String s : strings) {
                doubles[i] = Double.parseDouble(s);
                i++;
            }
            return doubles;
        }

        /**
         * This will set st to null
         */
        public char[] nextCharArray() throws IOException {
            st = null;
            String s = br.readLine();
            return s == null ? null : s.toCharArray();
        }

        /**
         * This will set st to null
         * Boolean at pos i true if char at pos i == c
         */
        public boolean[] nextBoolArray(char c) throws IOException {
            char[] chars = nextCharArray();
            if (chars == null) return null;
            boolean[] booleans = new boolean[chars.length];
            for (int i = 0; i < chars.length; i++) {
                booleans[i] = chars[i] == c;
            }
            return booleans;
        }

        public int[][] next2Dint(int lines) throws IOException {
            int[][] result = new int[lines][];
            for (int i = 0; i < lines; i++) {
                result[i] = nextIntLine();
            }
            return result;
        }

        public long[][] next2Dlong(int lines) throws IOException {
            long[][] result = new long[lines][];
            for (int i = 0; i < lines; i++) {
                result[i] = nextLongLine();
            }
            return result;
        }

        public char[][] next2Dchar(int lines) throws IOException {
            char[][] result = new char[lines][];
            for (int i = 0; i < lines; i++) {
                result[i] = nextCharArray();
            }
            return result;
        }

        public boolean[][] next2Dbool(int lines, char c) throws IOException {
            boolean[][] result = new boolean[lines][];
            for (int i = 0; i < lines; i++) {
                result[i] = nextBoolArray(c);
            }
            return result;
        }
    }
    //</editor-fold>
}