import sys, math input = lambda: sys.stdin.readline()[:-1] def MI(): return map(int, input().split()) inf = 10**18 mod = 10**9+7 from collections import * n = int(input()) a = list(MI()) cnt = [0] * 101 for i in a: cnt[i] += 1 ans = 0 for b1 in range(1, 101): for b2 in range(b1+1, 101): for b3 in range(b2+1, 101): ans += cnt[b1] * cnt[b2] * cnt[b3] ans %= mod print(ans)