Scanf.(scanf " %d %d %d" @@ fun n a b -> Array.(
  init n (fun _ -> scanf " %d" @@ fun v -> v)
  |> fold_left (fun (p,q,r) v ->
    if v<=a then (p+1,q,r)
    else if v<=b then (p,q+1,r)
    else (p,q,r+1)) (0,0,0)
  |> (fun (p,q,r) -> print_int @@ min p (min q r))))