import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author tym11 */ public class Ballon { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(;;) { String s = in.readLine(); if (s == null) break; HashSet hm = new HashSet<>(); int n = Integer.valueOf(s); for (int i = 0; i < n; ++i) { int code = 0; String cat = in.readLine(); for (char c: cat.toCharArray()) { int b = c - '0'; code |= 1 << b; } hm.add(code); } int result = hm.size(); System.out.println(result); } } }