using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder349
{
    class Program
    {
        static void Main(string[] args)
        {
            int cnt = int.Parse(Console.ReadLine());

            string[] s = new string[cnt];

            for (int i = 0; i < cnt; i++)
            {
                s[i] = Console.ReadLine();
            }

            if (s.GroupBy(c => c).Select(c => c.Count()).Max() <= ((cnt + 1) / 2))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}