from collections import Counter


N = int(input())
A = list(map(int, input().split()))

cnt: Counter = Counter()

for i in range(N):
    cnt[A[i]] += 1

ans = 0
for a in range(1, 99999 + 1):
    if a == 100000 - a:
        ans += cnt[a] * (cnt[a] - 1)
    else:
        ans += cnt[a] * cnt[100000 - a]

ans //= 2

print(ans)
