#include using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i,s,n) for(int i=(s); i<(n);++i) int a[101]={}; const int N=101; int main() { int n;cin>>n; rep(i, 0, n){ int t;cin>>t;a[t]++; } ll cnt=0; rep(i,0,N) rep(j,i+1,N) rep(k, j+1,N) { ll tt = (ll)a[i] * a[j] % mod; cnt += tt*a[k]; cnt %= mod; } cout << cnt << endl; }