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