/* * 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. */ import java.io.*; import java.util.*; /** * * @author cteam053 */ 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> map = new HashSet<>(); for (int i = 0; i < peopleCount; i++) { Set temp = new HashSet(); 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.equals("")) ? Integer.MIN_VALUE : Integer.parseInt(val); } }