let R() = stdin.ReadLine() let N = R() |> int let A = Array.init N (fun _ -> R()) let ans = let maxEtoNum = let EtoNums = A |> Array.countBy(fun x -> x) |> Array.map(fun (_, value) -> value) EtoNums |> Array.max let (|ODD|EVE|) n = match n % 2 with | 1 -> ODD | _ -> EVE let isEnable = match N with | ODD -> maxEtoNum <= N / 2 + 1 | EVE -> maxEtoNum <= N / 2 isEnable |> function | true -> "YES" | _ -> "NO" ans |> printfn "%s"