import java.util.Arrays; import java.util.Scanner; /* * 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 cteam056 */ public class Balloon { public static void main(String[] args) { Scanner s = new Scanner(System.in); while (s.hasNext()) { int n = s.nextInt(); int q[] = new int[n]; int qf = 0; for (int i = 0; i < n; i++) { int r = s.nextInt(); int[] o = new int[10]; int nextfreeindex = 0; for (int aa = 0; aa < 10; aa++) { o[aa] = -1; } for (int j = 0; j < 81; j++) { int ff = r % 10; if (ff == 0) { break; } r /= 10; lolipop: { for (int aa = 0; aa < nextfreeindex; aa++) { if (ff == o[aa]) { break lolipop; } } o[nextfreeindex] = ff; nextfreeindex++; } } Arrays.sort(o); int number = 0; int counter = 0; for (int aa = 0; aa < 10; aa++) { if (o[aa] != -1) { counter++; } } for (int aa = 0; aa < counter; aa++) { number += o[9 - aa]; number *= 10; } q[qf] = number; qf++; } Arrays.sort(q); int actual = q[0]; for (int p = 1; p < q.length; p++) { if (q[p] == actual) { q[p] = -1; } else { actual = q[p]; } } int fcq = 0; for (int p = 0; p < q.length; p++) { if (q[p] != -1) { fcq++; } } System.out.println(fcq); } } }