#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin >> N;
    vint a(N);
    map<int, int> cnt;
    set<int> s;
    rep(i, N)
    {
        cin >> a[i];
        cnt[a[i]]++;
        s.insert(a[i]);
    }
    bool ok = false;
    switch (s.size())
    {
    case 1:
        ok = a[0] == 0;
        break;
    case 2:
        ok = N % 3 == 0 and cnt[0] == N / 3;
        break;
    case 3:
        int x = *s.begin(), y = *(++s.begin()), z = *(++++s.begin());
        ok = x xor y xor z == 0 and N % 3 == 0 and cnt[x] == N/3 and cnt[y] == N/3 and cnt[z] == N/3;
        break;
    }
    ok ? cout << "Yes" : cout << "No";

    return 0;
}