/*#include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 0x3fffffff using namespace std; typedef long long ll; typedef pair PII; int has[100005]; int main() { int n, l, r; string s; while (cin >> n) { cin >> s; has[1] = s[0] - 28; for (int i = 1; i < s.length(); i++) { has[i + 1] = ((s[i] - 28) * has[i]) % 9973; } for (int i = 0; i < n; i++) { cin >> l >> r; if (l == 1) cout << has[r] << endl; else { while (has[r] % has[l - 1] != 0) has[r] += 9973; cout << (has[r] / has[l - 1]) % 9973 << endl; } } } return 0; }*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 0x3fffffff using namespace std; typedef long long ll; typedef pair PII; char s[10005]; int main() { int n; while (cin >> n) { map cnt; for (int i = 0; i < n; i++) { scanf("%s", s); sort(s, s + strlen(s)); cout << cnt[s]++ << endl; } } return 0; }