#include #include #include int main(int argc, char **argv) { int n,i,t,c; int cats[1024]; while(1) { scanf("%d", &n); if (feof(stdin)) break; for(i = 0; i < 1024; i++) { cats[i] = 0; } for(i = 0; i < n; i++) { scanf("%d", &t); c = 0; while (t) { c |= 1 << (t%10); t /= 10; } cats[c] = 1; } c = 0; for (i=0; i<1024; i++) { c += cats[i]; } printf("%d\n", c); } return 0; }