# coding: utf-8 #yuki_118 MOD=10**9+7 s=[0 for i in xrange(101)] n=int(raw_input()) l=map(int,raw_input().split()) for x in l: s[x]+=1 res=0 for i in xrange(101): for j in xrange(i+1,101): for k in xrange(j+1,101): res+=s[i]*s[j]*s[k] print res%MOD