long s;a[101],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[i]*a[j]*a[k];s=!printf("%d",s%=i=1e9+7);}