int a[1d6],b[1d6],c[1d6];string s[1d3];wgraphg;{int@n,@l,z;rd(s(n));rep(i,n)rep(j,n)c[z]+=s[i][0..l]!=s[j][0..],a[z]=i,b[z++]=j;g.setEdge(n,1d6,a,b,c);wt(g.MST_Prim_cost());}