import java.util.HashSet;
import java.util.Scanner;

public class Balloon {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            HashSet<HashSet<Character>> hm = new HashSet<>();

            for (int i = 0; i < n; i++) {
                HashSet<Character> h = new HashSet<Character>();
                String number = sc.next();
                for (char c : number.toCharArray()) {
                    h.add(c);
                }

                hm.add(h);
            }
            System.out.println(hm.size());
        }
    }
}
