if nums.uniq.size == 1
  puts n / 2
  exit
end

even_hash = Hash.new(0)
odd_hash = Hash.new(0)
n.times do |i|
  if i.even?
    even_hash[nums[i]] += 1
  else
    odd_hash[nums[i]] += 1
  end
end
count = 0
count += n / 2 - even_hash.max_by { |k, v| v }.last
count += n / 2 - odd_hash.max_by { |k, v| v }.last

puts count
