a[101],s,j,k;main(i){for(gets(a);~scanf("%d",&i);a[i]++);for(;++k<101;)for(j=k;++j<101;)for(i=j;++i<101;s%=*a=1e9+7)s+=a[i]*a[j]*a[k];printf("%d",s);}