링크 : https://www.acmicpc.net/problem/3273
/*
문제 : 두 수의 합
링크 : https://www.acmicpc.net/problem/3273
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v;
int main(){
int n;
cin >> n;
for(int i = 0, tmp; i<n; i++){
cin >> tmp;
v.push_back(tmp);
}
int target;
cin >> target;
sort(v.begin(), v.end());
int start = 0, end = n-1, cnt = 0;
while(start < end){
if(v[start] + v[end] == target){
cnt ++;
end --;
start ++;
}
else if(v[start] + v[end] >= target) end --;
else start ++;
}
cout << cnt;
return 0;
}