import itertools from collections import Counter N = int(input()) A = Counter(map(int, input().split())) lA = len(A) MOD = 10 ** 9 + 7 ans = 0 for t in itertools.combinations(range(1, 101), 3): ans = (ans + A[t[0]] * A[t[1]] * A[t[2]]) % MOD print(ans)