import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by cteam040 on 10/22/16.
 */
public class Balloon {
    private static Set<String> groups = new HashSet<>();

    private static void processLine(String line) {
        Set<Character> chars = new HashSet<>();
        for (char c : line.toCharArray()) {
            chars.add(c);
        }

        StringBuffer stringBuffer = new StringBuffer();
        for (char c : chars) {
            stringBuffer.append(c);
        }

        groups.add(stringBuffer.toString());
    }

    private static void runTestCase(BufferedReader in, int testCount) throws IOException {
        groups.clear();

        for (int i = 0; i < testCount; i++) {
            processLine(in.readLine());
        }

        System.out.println(groups.size());
    }

    public static void main(String[] args) throws IOException {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        while (true) {
            String line = in.readLine();
            if (line == null) break;
            int nTest = Integer.parseInt(line);
            runTestCase(in, nTest);
        }
    }
}
