#include #include #include #include #include using namespace std; const int N = 1e6 + 10; const int MOD = 1e9 + 7; char str[45]; int a[45]; std::map mp; int main() { int n; scanf ("%d", &n); mp.clear (); string str; for (int i=0; i> str; sort (str.begin (), str.end ()); printf ("%d\n", mp[str]); mp[str]++; } return 0; }