import algorithm, sequtils, strutils

let
  n = parseInt readLine stdin
  xs = stdin
         .readLine
         .split
         .map(parseInt)
         .sorted
         .deduplicate(true)
  d = xs[1].pred xs[0]

if xs.len < n:
  echo "NO"
  quit()

for i in 1..xs.high:
  if xs[i].pred(xs[i.pred]) != d:
    echo "NO"
    quit()

echo "YES"