ll@n,@p,@a[n],q=1,z=0; while(q*=p,q<1d9){ maph; rep(i,n){ z+=h[a[i]%q]++; } } wt(z);