#include #include int main() { int answer[1000], st2[10], ch[10], ans, i, j, n, t, count; long int x; st2[1] = 2; for (i = 2; i < 10; i++) st2[i] = st2[i - 1]*2; while (scanf("%d", &n) != EOF) { count = 0; for (i = 0; i < n; i++) { scanf("%li", &x); for (j = 1; j < 10; j ++) ch[j] = 0; //for (j = 0; j < strlen(s); j++) printf("%c ", s[j]); while (x > 0) { ch[x % 10] = 1; x = x / 10; } //for (j = 1; j < 9; j++) printf("%d ", ch[j]); //printf("\n"); ans = 0; for (j = 1; j <= 9; j++) ans += st2[j]*ch[j]; t = 0; for (j = 0; j < count; j++) if (answer[j] == ans) { t = 1; break; } if (t == 0) answer[count++] = ans; } printf("%d\n", count); } return 0; }