// yukicoder 118 (http://yukicoder.me/problems/221) #include #define rep(i,a) for(int i=0;i<(a);++i) typedef long long ll; const int MAX_N = 100000, mod = 1000000007; int N; ll cnt[101]; int main() { scanf( "%d", &N ); rep( i, N ) { int A; scanf( "%d", &A ); ++cnt[A]; } int ans = 0; rep( i, 101 ) rep( j, i ) rep( k, j ) ans = (ans+cnt[i]*cnt[j]*cnt[k]) % mod; printf( "%d\n", ans ); return 0; }