#include #include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; ll mod = 1e9+7; uintmax_t combination(unsigned int n, unsigned int r) { if ( r * 2 > n ) r = n - r; uintmax_t dividend = 1; uintmax_t divisor = 1; for ( unsigned int i = 1; i <= r; ++i ) { dividend *= (n-i+1); dividend %= mod; divisor *= i; } return dividend / divisor; } int main(){ int n; ll cnt = 0, mul = 1, ans = 0; cin >> n; vector v(101), v1; for (int i = 0; i < n; i++) { int t; cin >> t; v[t]++; } for (int i = 1; i < 101; i++){ if (v[i]) { v1.push_back(i); cnt++; } } if (cnt >= 3){ for (int i = 0; i < v1.size()-2; i++){ for (int j = i+1; j < v1.size()-1; j++){ for (int k = j+1; k < v1.size(); k++){ ans += v[v1[i]]*v[v1[j]]%mod*v[v1[k]]%mod; ans %= mod; } } } } if (cnt < 3) cout << 0 << endl; else cout << ans << endl; }