N, X = gets.split(" ").map{|s| s.to_i} a = [] N.times { a << gets.to_i } a.sort! used = [] cnt = 0 a.uniq.each {|y| next if used.include?(y) ymin = a.bsearch_index{|i| i >= y} ymax = a.bsearch_index{|i| i > y} ymax = N if not ymax ycnt = ymax - ymin z = y ^ X if z == y then cnt += ycnt * (ycnt - 1) next end zmin = a.bsearch_index{|i| i >= z} next if not zmin used << z zmax = a.bsearch_index{|i| i > z} zmax = N if not zmax zcnt = zmax - zmin cnt += ycnt * zcnt } puts cnt