import java.util.*; public class Main { static Point[] points; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap map = new HashMap<>(); for (int i = 0; i < n; i++) { String eto = sc.next(); if (map.containsKey(eto)) { map.put(eto, map.get(eto) + 1); } else { map.put(eto, 1); } } int max = 0; for (int x : map.values()) { max = Math.max(max, x); } if ((n + 1) / 2 >= max) { System.out.println("YES"); } else { System.out.println("NO"); } } static int getCount(int idx, ArrayList list, boolean[] used, int score) { if (idx >= points.length) { return score; } int ans = getCount(idx + 1, list, used, score); Point p = points[idx]; if (used[p.left]) { if (used[p.right]) { boolean flag = false; for (int x : list) { if (x == p.left) { flag = true; } else if (x == p.right) { if (flag) { ans += p.value; } break; } } } else { boolean flag = false; for (int i = 0; i <= list.size(); i++) { if (flag) { used[p.right] = true; list.add(i, p.right); ans = Math.max(ans, getCount(idx + 1, list, used, score + p.value)); used[p.right] = false; list.remove(i); } else { if (list.get(i) == p.left) { flag = true; } } } } } else { if (used[p.right]) { boolean flag = false; for (int i = list.size() - 1; i >= 0; i--) { if (flag) { used[p.left] = true; list.add(i, p.left); ans = Math.max(ans, getCount(idx + 1, list, used, score + p.value)); used[p.left] = false; list.remove(i); } else { if (list.get(i) == p.right) { flag = true; i--; } } } } else { for (int i = 0; i <= list.size(); i++) { used[p.left] = true; list.add(i, p.left); for (int j = i + 1; j <= list.size(); j++) { used[p.right] = true; list.add(j, p.right); ans = Math.max(ans, getCount(idx + 1, list, used, score + p.value)); used[p.right] = false; list.remove(j); } used[p.left] = false; list.remove(i); } } } return ans; } static class Point { int left; int right; int value; public Point(int left, int right, int value) { this.left = left; this.right = right; this.value = value; } } }