#include <bits/stdc++.h>
using namespace std;

typedef long long  ll;
 
int main() {
 
    int n;
    cin>>n;
    
    
    vector <int> ar;
    for(int i=0;i<=n-1;i++){
    	int y;cin>>y; 
    	ar.push_back(y); 
    }
    
    ll target ;
    cin>>target;
ll count =0;
unordered_map<ll,ll>mpp;

for(int j=0;j<n;j++){
	ll rem = target+ar[j];
	
	if(mpp.find(rem)!=mpp.end())
	count+=mpp[rem];
	
	mpp[ar[j]]++;
}
cout<<count;

	// your code goes here
	return 0;
}