#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<>N; int A; rep(i,N){ cin>>A; L[A]++; } S[100] = L[100]; for(int i=99;i>=0;--i){ S[i] = L[i] + S[i+1]; } LL ans = 0; for(int i=1;i<=100-2;++i){ for(int k = i+1;k<=100-1;++k){ ans = (ans + (L[i]*L[k]*S[k+1])%mod)%mod; } } P(ans); return 0; }