ll N,A[1d5],d[101],x; { rd(N,A(N)); ++d[A[0..N-1]]; rep(i,101)rep(j,i)rep(k,j){ x+=d[i]*d[j]*d[k]; } wt(x%=1d9+7); }