N=int(raw_input()) a=map(int,raw_input().split()) cnt=[0 for i in range(101)] for i in a: cnt[i]+=1 ans=0 for i in range(1,101): for j in range(i+1, 101): for k in range(j+1,101): ans+=cnt[i]*cnt[j]*cnt[k] ans%=1000000007 print ans