import java.util.*; public class Exercise29{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int size = sc.nextInt(); String[] eto = new String[size]; for (int n = 0; n < size; n++){ eto[n] = sc.next(); } int max = 0; for (int n = 0; n < size - 1; n++){ int count = 1; for (int j = n + 1; j < size; j++){ if (eto[n].equals(eto[j])){ count++; } } max = Math.max(max, count); } boolean flag = true; if (size % 2 == 0){ if (max > size / 2){ flag = false; } }else{ if (max > size / 2 + 1){ flag = false; } } System.out.println(flag ? "YES" : "NO"); } }