#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { int N; cin >> N; int A[101] = {0}; for ( int i = 0; i < N; i++ ) { int a; cin >> a; A[a]++; } long long ans = 0; for ( int i = 1; i <= 100; i++ ) { for ( int j = i+1; j <= 100; j++ ) { for ( int k = j+1; k <= 100; k++ ) { ans += ( A[i] * A[j] * A[k] )%MOD; ans %= MOD; } } } cout << ans << endl; return 0; }