import java.io.*;
import java.util.*;

public class Balloon {

    private static BufferedReader b;

    public static void main(String[] args) throws Exception {
        b = new BufferedReader(new InputStreamReader(System.in));
        String output = "";
        int peopleCount;
        while ((peopleCount = readNumber()) != Integer.MIN_VALUE) {
            Set<Set<Integer>> map = new HashSet<>();

            for (int i = 0; i < peopleCount; i++) {
                Set<Integer> temp = new HashSet<Integer>();
                char[] passager = b.readLine().toCharArray();
                for (char q : passager) {
                    temp.add(new Integer(String.valueOf(q)));
                }
                map.add(temp);
            }
            
            output += Integer.toString(map.size()) + "\n";
        }
        System.out.print(output);
    }

    private static int readNumber() throws Exception {
        String val = b.readLine();
        return (val == null || val.equals("")) ? Integer.MIN_VALUE : Integer.parseInt(val);
    }
}