#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

auto has(vector<pair<int, int> >::iterator begin, vector<pair<int, int> >::iterator end, int number);

auto has(vector<pair<int, int> >::iterator begin, vector<pair<int, int> >::iterator end, int number)
{
    for(auto itr = begin; itr != end; itr++){
        if(itr->first == number){
            return itr;
        }
    }

    return end;
}


int main(void)
{
    int hat_count;
    vector<int> numbers;
    bool contain_zero = false;
    vector<pair<int, int> > numbers_count;

    cin >> hat_count;

    for(int i = 0; i < hat_count; i++){
        int n;
        cin >> n;
        numbers.push_back(n);
    }

    for(auto itr = numbers.begin(); itr != numbers.end(); itr++){
        auto has_itr = has(numbers_count.begin(), numbers_count.end(), *itr);

        if(has_itr == numbers_count.end()){
            if(*itr == 0){
                contain_zero = true;
            }
            numbers_count.push_back(make_pair(*itr, 1));
        }else{
            has_itr->second++;
        }
        if(numbers_count.size() > 3){
            break;
        }
    }

    if(hat_count % 2 == 0){
        if(!contain_zero){
            cout << "No" << endl;
            return 0;
        }
        if(numbers_count.size() != 2){
            cout << "No" << endl;
            return 0;
        }
        if(numbers_count[0].second != numbers_count[1].second){
            cout << "No" << endl;
            return 0;
        }
    }else{
        if(contain_zero){
            cout << "No" << endl;
            return 0;
        }
        if(numbers_count.size() != 3){
            cout << "No" << endl;
            return 0;
        }
        if((numbers_count[0].second != hat_count / 3) && (numbers_count[0].second != hat_count / 3 - 1)){
            cout << "No" << endl;
            return 0;
        }
        if((numbers_count[1].second != hat_count / 3) && (numbers_count[1].second != hat_count / 3 - 1)){
            cout << "No" << endl;
            return 0;
        }
        if((numbers_count[2].second != hat_count / 3) && (numbers_count[2].second != hat_count / 3 - 1)){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;


    return 0;
}