#include<bits/stdc++.h>
using namespace std;
int main()
{
    //ifstream fi("sumx.inp");
    //ofstream fo("sumx.out");
    int64_t n,x;
    fi>>n;
    int64_t a[n+1];
    for(int64_t i=1;i<=n;i++)
    {
        fi>>a[i];
    }
    int64_t dem=0;
    sort(a+1,a+n+1);
    fi>>x;
    for(int64_t i=1;i<n;i++)
    {
        for(int64_t j=i;j<=n;j++)
        {
            if(a[i]>x/2)
            {
                break;
            }
            else
            {
                if(a[i]+a[j]==x)
                {
                    dem++;
                }
            }
        }
    }
    fo<<dem;
}
