let n = Scanf.scanf " %d" (+) 0
let vs = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let css = Array.init 2 @@ fun _ -> Array.init 100001 @@ fun i -> 0, i
let (e0, em), e1, (o0, om), o1 = Array.iteri (fun i v -> css.(i mod 2).(v) <- let c, i = css.(i mod 2).(v) in c + 1, i) vs;
  List.iter (fun i -> Array.sort (fun x y -> compare y x) css.(i)) [0; 1];
  css.(0).(0), fst css.(0).(1), css.(1).(0), fst css.(1).(1)
let _ = Printf.printf "%d\n" @@ if em = om then n - max (e0 + o1) (e1 + o0) else n - e0 - o0