let h()=Scanf.scanf"%d %d %d %d\n"(fun a b c d->[a;b;c;d]);;
let rec f()=
  let a=h() in
  let b=h() in
  let n=List.fold_left2(fun a x y->if x=y then a+1 else a)0 a b in
  f(Printf.printf"%d %d\n" n ((List.fold_left(fun a e->if List.mem e b then a+1 else a)0 a)-n))
;;try f()with _->()