import sys
input = sys.stdin.readline
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
x = int(input())
ans = 0
start = 0
end = N-1
while start < end:
val = lst[start] + lst[end]
if val == x:
ans += 1
start += 1
elif val > x:
end -= 1
elif val < x:
start += 1
print(ans)