require 'prime'




primes = Prime.each(25000).to_a




until (n = gets.to_i) == 0
&#160; &#160; res = 0
&#160; &#160; if n.odd?
&#160; &#160; &#160; &#160; puts Prime.prime?(n-2)?1:0
&#160; &#160; else
&#160; &#160; &#160; &#160; primes.each do |p|
&#160; &#160; &#160; &#160; &#160; &#160; break if p > n/2+1
&#160; &#160; &#160; &#160; &#160; &#160; res += (Prime.prime?(n - p))?1:0
&#160; &#160; &#160; &#160; end
&#160; &#160; &#160; &#160; puts res
&#160; &#160; end
end