ll N,A[1d5],d[101],x; { rd(N,A(N)); ++d[A[0..N-1]]; x+=d[1..100]*d[1...100]*d[1....100]; x-=d[1..100]**2*d[1...100]*3; x+=d[1..100]**3*2; wt(x/6%(1d9+7)); }