#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; #define min(a,b) (a>b?b:a) #define max(a,b) (a>b?a:b) #define mem(a,num) memset(a,num,sizeof(a)) #define inf(a,n) fill(a,a+n,0x3f3f3f3f) int main() { ios::sync_with_stdio(false); int n; while(cin>>n) { map m; string a; while(n--){ cin>>a; sort(a.begin(),a.end()); cout<<(m[a]++)<