class A def initialize n = gets.chomp.to_i x = gets.chomp.split(' ').map(&:to_i) puts x.count - 2 * [x.count{|i| i.even?}, x.count{|i| i.odd?}].min end end A.new