n = gets.to_i
as = gets.chomp.split.map(&:to_i)

def judge(x)
  return false if x < 2
  return true if x == 2
  while true
    return false unless x % 2 == 0
    return true if x == 2
    x /= 2
  end
end

cnt = 0
n.times do |i|
  ((i + 1)...n).each do |j|
    next unless judge(as[i] + as[j])
    cnt += 1
    break
  end
end

puts cnt