let rec solve() = 
  let rec input = function
    | 0 -> []
    | n -> Scanf.scanf "%d\n" (fun x -> x::input (n - 1)) in
  let rec ura i n = function
    | [] -> if i > n then [] else i::ura (i + 1) n []
    | w::d as q -> if i = w then ura (i + 1) n d else i::ura (i + 1) n q in
  let rec last p l a b =
    let rec can n = function
      | [] -> (0,[])
      | w::d -> if n < w then (w,d) else
          let (w1,w2) = can n d in
          (w1,w::w2) in

    let (pp,ll,aa,bb) = if p then
      let (w1,w2) = can l a in
      (false,w1,w2,b)
    else
      let (w1,w2) = can l b in
      (true,w1,a,w2) in
    if aa = [] || bb = [] then (List.length aa,List.length bb) else last pp ll aa bb in

  let n = Scanf.scanf "%d\n" (fun x -> x) in
  if n = 0 then () else begin
    let d1 = List.sort compare (input n) in
    let d2 = ura 1 (n * 2) d1 in
    let (a,b) = last true 0 d1 d2 in
    Printf.printf "%d\n%d\n" b a;
    solve() end

let _ = solve()