module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let vs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun v -> v in
  let odds =
    IntMap.bindings @@
    Array.fold_left (fun m v ->
      IntMap.add v (1 + try IntMap.find v m with Not_found -> 0) m) IntMap.empty @@
    Array.init (n / 2) @@ fun i -> vs.(2 * i + 1) in
  let evens =
    IntMap.bindings @@
    Array.fold_left (fun m v ->
      IntMap.add v (1 + try IntMap.find v m with Not_found -> 0) m) IntMap.empty @@
    Array.init (n / 2) @@ fun i -> vs.(2 * i) in
  let v, m, m' =
    match odds with
    | [(v, n)] -> v, n, 0
    | (v, n) :: (_, n') :: _ -> v, n, n' in
  let v_, m_, m_' =
    match evens with
    | [(v, n)] -> v, n, 0
    | (v, n) :: (_, n') :: _ -> v, n, n' in
  Printf.printf "%d\n" @@ n - if v = v_ then max (m + m_') (m' + m_) else m + m_
