#include typedef long long ll; using namespace std; int main() { int n; while (cin>>n) { ll a[101]={}; while (n--) { int t; cin>>t; a[t]++; } ll res=0; const int mod=1e9+7; for(int i=1;i<=100;++i) for(int j=i+1;j<=100;++j) for(int k=j+1;k<=100;++k) res=(res+(ll)a[i]*a[j]%mod*a[k])%mod; cout<