#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 int main() { int n; cin >> n; vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; a[i]--; } vector cnt(100); for (int i = 0; i < n; ++i) { cnt[a[i]]++; } ll ans = 0; for (int i = 0; i < 100; ++i) { for (int j = i + 1; j < 100; ++j) { for (int k = j + 1; k < 100; ++k) { ll res = (cnt[i] * cnt[j]) % MOD; res = (res * cnt[k]) % MOD; ans = (ans + res) % MOD; } } } cout << ans << endl; return 0; }