let _ = int_of_string (read_line())
let s = read_line()
let vs = Str.split (Str.regexp " ") s |> List.map int_of_string
let rec loop = function
 | [] -> [],[]
 | [a] -> [a],[]
 | a::b::xs ->
   let aa,bb = loop xs in
   a::aa,b::bb

let vs1,vs2=loop vs
module M = Map.Make(struct type t=int let compare=compare end)

let f vs m =
  let (v,c,_) = List.fold_left(fun (mv,mc,m) v ->
        let c = (try M.find v m with _ -> 0)+1 in
        if c > mc then (v,c,M.add  v c m) else
        (mv,mc,M.add  v c m)
  ) (0,0,m) vs in
  (v,c)

let (v1,vm1)=f vs1 M.empty
let (v2,vm2)=f vs2 M.empty
let p vm1 vm2 =
  let n = (List.length vs1-vm1)+(List.length vs2-vm2) in
  Printf.printf "%d\n" n

let p2 vm1 vm2 vm1' vm2' =
  let n1 = (List.length vs1-vm1')+(List.length vs2-vm2) in
  let n2 = (List.length vs1-vm1)+(List.length vs2-vm2') in
  Printf.printf "%d\n" (min n1 n2)
let _ =
  if v1 <> v2 then (p vm1 vm2) else
          let (v2',vm2') = f vs2 (M.singleton v1 (-10000)) in
          let (v1',vm1') = f vs1 (M.singleton v1 (-10000)) in
          p2 vm1 vm2 vm1' vm2'