import sequtils,strutils,algorithm,tables let n = stdin.readLine().parseInt() var B = toSeq(newSeqWith(n,stdin.readLine()).sorted(cmp).toCountTable().values).sorted(cmp) if B.len == 1 : if B[0] <= 1 : quit "YES",0 else: quit "NO",0 while true: B = B.sorted(cmp) B[^1] -= 1 B[^2] -= 1 if B[^1] < 0 : quit "NO",0 if B[^2] == 0 and B[^1] <= 1 : quit "YES",0