import sequtils,strutils,algorithm,tables let n = stdin.readLine().parseInt() var B = toSeq(newSeqWith(n,stdin.readLine()).sorted(cmp).toCountTable().values).sorted(cmp) 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