gets
vs = gets.split.map(&:to_i)

count0 = Hash.new(0)
count1 = Hash.new(0)
vs.each_slice(2) do |a, b|
  count0[a] += 1
  count1[b] += 1
end

max0 = count0.values.max
max1 = count1.values.max

n = vs.size / 2
num0 = n - max0
num1 = n - max1

result = num0 + num1
result = n if result.zero? && vs[0] == vs[1]

puts result