print((function (f) local a,h,r,n,x={},{},0,f(),f() for i=1,n do a[i]=f() end for i=1,n do if h[a[i]]==nil then h[a[i]]=0 end h[a[i]]=h[a[i]]+1 end for i=1,n do if h[x-a[i]]~=nil then r=r+h[x-a[i]] end end return r end)((function (M) M.cdef 'int scanf(const char *, ...);' local C,c = M.C,M.new("int[1]") return function () C.scanf("%d",c) return c[0] end end)(require'ffi')))