using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<string, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        var dmax = 0;
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            if (d.ContainsKey(s)) d[s]++;
            else d[s] = 1;
            dmax = Math.Max(dmax, d[s]);
        }
        if (n % 2 == 0 && dmax <= n / 2) Console.WriteLine("YES");
        else if (n % 2 == 1 && dmax <= (n + 1) / 2) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
}