package no349; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long max = Stream.generate(sc::next).limit(n) .collect(Collectors.groupingBy(x -> x, Collectors.counting())).values().stream().mapToLong(x -> x).max().getAsLong(); System.out.println(max <= (n+1)/2 ? "YES" : "NO"); } }