#include<bits/stdc++.h>
#define inf 2147483647
#define llinf 9223372036854775807
#define ll long long
using namespace std;
const int maxn = 2e5 + 10;

int n;
long long a[maxn];
map<long long, int> cnt;
int tot, num[maxn];


inline long long read(){
    char c=getchar();long long x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    n = read();
    if (n % 3 != 0) return puts("No"), 0;
    for (int i = 1; i <= n ; i++) {a[i] = read(); if(cnt[a[i]] == 0) {cnt[a[i]] = ++tot;} num[cnt[a[i]]]++;}
    if (tot == 1) return puts("Yes"), 0;
    if (tot == 2) if (num[1] = 2 * num[2] || num[2] = num[1] * 2) return puts("Yes"), 0; else return puts("No"), 0;
    if (tot != 3) return puts("No"), 0;
    if (num[1] != num[2] || num[2] != num[3]) return puts("No"), 0;
    puts("Yes");
    return 0;
}
