N = int(input()) As = list(map(int, input().split())) freq = [0] * 101 for a in As: freq[a] += 1 count = 0 mod = 10**9 + 7 for i in range(99): fi = freq[i] for j in range(i+1, 100): fifj = (fi * freq[j]) % mod for k in range(j+1, 101): count += fifj * freq[k] count %= mod print(count)