#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD 1e9 + 7 #define INF 100000000 using namespace std; typedef long long LL; typedef vector VI; typedef pair PI; int main() { int n; cin >> n; int a[101] = {}; REP(i, n) { int t = 0; cin >> t; a[t]++; } LL ans = 0; FOR(i, 1, 101) { FOR(j, i + 1, 101) { FOR(k, j + 1, 101) { ans += 1LL * a[i] * a[j] * a[k]; } } } cout << ans % LL(MOD) << endl; return 0; }