import java.util.*; class Balloon { public static void main(String args[]) { Scanner in = new Scanner(System.in); while(true) { if(!in.hasNextInt()) break; int n = in.nextInt(); in.nextLine(); ArrayList groups = new ArrayList(); String line; for(int i = 0; i < n; i++) { line = in.nextLine(); ArrayList list = new ArrayList(); for(int j = 0; j < line.length(); j++){ char c = line.charAt(j); if(!list.contains(c)) list.add(c); if(list.size() >= 9) break; } list.sort(null); line = list.toString(); if(!groups.contains(line)) groups.add(line); } System.out.println(groups.size()); } } }