t = {} n = io.read("*n", "*l") for i = 1, n do s = io.read() if(t[s] == nil) then t[s] = 1 else t[s] = t[s] + 1 end end max = 1 for k, v in pairs(t) do max = math.max(max, v) end if(max <= math.floor((n + 1) / 2)) then print("YES") else print("NO") end