#include #include #include #include #define FORR(i,b,e) for(int i=(b);i<(int)(e);++i) #define FOR(i,e) FORR(i,0,e) #define dump(var) cerr << #var ": " << var << "\n" #define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n" typedef long long ll; typedef unsigned long long ull; const ull MODD = 1e9+7; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; vector A; map acnt; cin >> N; A.resize(N); FOR(i, N) { cin >> A[i]; acnt[A[i]]++; } sort(A.begin(), A.end()); A.erase(unique(A.begin(), A.end()), A.end()); ull pcnt = 0; int l = A.size(); FOR(i, l-2) { FORR(j, i+1, l-1) { FORR(k, j+1, l) { pcnt = (pcnt + acnt[A[i]]*acnt[A[j]]*acnt[A[k]]) % MODD; } } } cout << pcnt << endl; return 0; }