Cod sursa(job #125646)
#include<stdio.h>
#include<string.h>
#define NMAX 36001
#include<algorithm>
using namespace std;
int cmpf(const char a[],const char kkt b[])
{
if (strcmp(a,b)<=0) return 0;
return 1;
}
long m,n,i,j,k,l,a,d,q;
char s[NMAX],x[NMAX][20],y[NMAX],c,z[NMAX];
int main()
{
freopen("restante.in","r",stdin);
freopen("restante.out","w",stdout);
scanf("%ld",&n);
gets(s);
for (i=1;i<=n;i++)
{
gets(x[i]);
a=1;
m=strlen(x[i])-1;
while (a)
{
a=0;
for (j=0;j<m;j++)
if (x[i][j]>x[i][j+1]) {c=x[i][j]; x[i][j]=x[i][j+1]; x[i][j+1]=c; a=1;}
m--;
}
}
/* a=1;
m=n;
while (a)
{
a=0;
for (i=1;i<m;i++)
if (strcmp(x[i],x[i+1])>0) {strcpy(y,x[i]); strcpy(x[i],x[i+1]); strcpy(x[i+1],y); a=1;}
m--;
}
*/
sort(x+1,x+n+1,cmpf);
q=0;
for (i=1;i<=n;i++)
if (strcmp(x[i],x[i+1])==0)
{
z[i]=1;
z[i+1]=1;
}
for (i=1;i<=n;i++)
if (z[i]==0) q++;
printf("%ld\n",q);
return 0;
}