// Arup Guha
// 10/12/2013
// Solution to UCF JV Practice Problem C: Permutations

import java.util.*;

public class c {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int[] freq = new int[1001];

		// Note: Based on the rules, we can create any which array we want. Note that some sorts
		// just swap consecutive elements. In general, we can use a sequence of consecutive element
		// swaps to just swap any two arbitrarily chosen elements.

		// Just store how many of each item there is.
		for (int i=0; i<n; i++)
			freq[stdin.nextInt()]++;

		// The best we can do is space out equal values with one in between. If there
		// are too many of one value, we can't do it.
		boolean flag = true;
		for (int i=0; i<1001; i++)
			if (freq[i] > (n+1)/2 && n > 1)
				flag = false;

		// Output result.
		if (flag)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}