n=int(input())
A=list(map(int, input().split()))
target=int(input())
counter=0
mp={}
for j in range(n):
r=target + A[j]
counter+=mp.get(r, 0)
mp[A[j]]=mp.get(A[j], 0) + 1
print(counter)
bj1pbnQoaW5wdXQoKSkKQT1saXN0KG1hcChpbnQsIGlucHV0KCkuc3BsaXQoKSkpCnRhcmdldD1pbnQoaW5wdXQoKSkKY291bnRlcj0wCm1wPXt9CmZvciBqIGluIHJhbmdlKG4pOgogICAgcj10YXJnZXQgKyBBW2pdCiAgICBjb3VudGVyKz1tcC5nZXQociwgMCkKICAgIG1wW0Fbal1dPW1wLmdldChBW2pdLCAwKSArIDEKcHJpbnQoY291bnRlcik=