import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; /** * * @author kontris */ public class Balloon { /** * @param args the command line arguments */ private static int poc; public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = input.readLine()) != null) { poc = Integer.parseInt(line); LinkedList> list = new LinkedList<>(); HashSet set; tmpc: for (int i = 0; i < poc; i++) { line = input.readLine(); set = new HashSet<>(); for (int j = 0; j < line.length(); j++) { set.add(line.charAt(j)); } for (HashSet hashSet : list) { if (hashSet.containsAll(set)) { continue tmpc; } } list.add(set); } System.out.println(list.size()); } } }