'use strict'
function main(input) {
  input = input.trim().split('\n')
  const N = input.shift() - 0
  input = input[0].split(' ')
  let a = {}
  let b = {}
  for (let i = 0; i < N; i++) {
    if (i%2) {
      let num = input[i] - 0
      if (!(num in a)) a[num] = 0
      a[num]++
    } else {
      let num = input[i] - 0
      if (!(num in b)) b[num] = 0
      b[num]++
    }
  }

  const newArr = [
    ...(Object.keys(a).map(v => [v, a[v], 0])),
    ...(Object.keys(b).map(v => [v, b[v], 1]))
  ].sort((a, b) => b[1] - a[1])

  let ans = 0
  let selected = [-1, -1]
  newArr.forEach(arr => {
    if (selected[arr[2]] < 0 && selected[Math.abs(arr[2]-1)] !== arr[0]) {
      selected[arr[2]] = arr[0]
    } else {
      ans += arr[1]
    }
  })

  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
