N = int(input())
lst = list(map(int, input().split()))
X = int(input())
lst.sort()
s = 0
e = N-1
cnt = 0
while s < e:
hap = lst[s] + lst[e]
if hap == X:
cnt += 1
s += 1
e -= 1
elif hap < X:
s += 1
elif hap > X:
e -= 1
print(cnt)```