#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; struct Node { int sz; map ch; Node() { sz = 0; } } *root; int insert(char *s) { Node *cur = root; while(*s) { int i = *s++; if(!cur->ch[i]) cur->ch[i] = new Node(); cur = cur->ch[i]; } return cur->sz++; } char s[123]; int main() { root = new Node(); int n; scanf("%d", &n); while(n--) { scanf("%s", s); int l = strlen(s); sort(s, s + l); printf("%d\n", insert(s)); } return 0; }