#include <bits/stdc++.h>   using namespace std;   int N, M, dbg[100005];   pair<int, int> A[100005];   map<int, int> mp;   int main() {     scanf( %d , &N);     for (int i = 0; i < N; i++) {       int a;       scanf( %d , &a);       mp[a]++;     }     for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)       A[M++] = *it;     for (int i = 1; i < M; i++)       if (A[i].first != A[i - 1].first + 1) {         puts( NO );         return 0;       }     int p = 0;     for (int i = 0; i < M; i++) {       A[i].second--;       dbg[p++] = A[i].first;     }     for (int i = M - 1; i > 1; i--) {       while (A[i].second) {         if (!A[i - 1].second) {           puts( NO );           return 0;         }         A[i - 1].second--;         A[i].second--;         dbg[p++] = A[i - 1].first;         dbg[p++] = A[i].first;       }       if (!A[i - 1].second) {         puts( NO );         return 0;       }       A[i - 1].second--;       dbg[p++] = A[i - 1].first;     }     while (A[1].second) {       if (!A[0].second) {         puts( NO );         return 0;       }       A[0].second--;       A[1].second--;       dbg[p++] = A[0].first;       dbg[p++] = A[1].first;     }     if (A[0].second) {       puts( NO );       return 0;     }     puts( YES );     return 0;   }   