#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define pi 3.1415926535897932384626
#define MX 1e5 + 5
#define MOD 1000000007
#define ll long long 
#define int long long
#define ull unsigned long long 
#define ld long double
#define pb push_back
#define mp make_pair
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << " , " << #y << " = " << y << endl
#define clr(x) memset(x, 0, sizeof(x))
#define ff first
#define ss second

#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define fr(i, j, k, in) for (int i = j; i < k; i += in)
#define rfr(i, j, k, in) for (int i = j; i >= k; i -= in)
#define freach(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define rfo(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, n) for (int i = 0; i < n; i++)
#define foa(i, a, n) for (int i = a; i < n; i++)
#define endl "\n"
#define sz(a) a.size()
#define digits(n) 1 + floor(log10(n))
#define prec(n) fixed << setprecision(n)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x), greater<int>())
#define sortarr(n, x) sort(n, n + x)

#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

#define miiitr map<int, int>::iterator it;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pair<int, int>> vii;
typedef vector<vector<int>> vvi;
typedef map<int, int> mpii;
typedef set<int> sti;

/****** Template of some basic operations *****/
template <typename T, typename U>
inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
/**********************************************/

/**********output of pair , set , map , vector ********/
template <typename T, typename G>
ostream &operator<<(ostream &out, const pair<T, G> &a)
{
    return out << "(" << a.first << " , " << a.second << ")";
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &a)
{
    out << "[";
    for (const auto &i : a)
        out << i << " , ";
    return out << "]";
}

template <typename T>
ostream &operator<<(ostream &out, const set<T> &a)
{
    out << "{";
    for (const auto &i : a)
        out << i << " , ";
    return out << "}";
}

template <typename T, typename G>
ostream &operator<<(ostream &out, const map<T, G> &a)
{
    out << "<";
    for (const auto &i : a)
        out << i << " , ";
    return out << ">";
}
/**********************************************/
/*************input output of vector***************/
//vi arr = i_vector<int>(n);
//print_stl(arr);
template <typename T>
vector<T> i_vector(int n)
{
    vector<T> v(n);
    T temp;
    for (auto it = v.begin(); it != v.end(); it++)
    {
        cin >> *it;
    }
    return v;
}

template <typename T>
void print_stl(T arr)
{

    for (auto itr = arr.begin(); itr != arr.end(); ++itr)
    {
        cout << *itr << " ";
    }
    cout << endl;
}
/**********************************************/
int n, m, k , x , q , y , t ;
vi a ;


void solve()
{
    cin >> n;
    int count = 0;
    fo(i , n ){
        cin>> m ;
        count^=((i+1)^m) ;
    }
    if(!count){
        cout << "Yes" ;
    }else{
        cout << "No" ;
    }
    // print_stl(a);
}
int32_t main()
{
    fast;
    int t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}

//in dp prefix suffix sum helps..
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include <iterator>
#include <map>
#include<list>
#include <fstream>
#include<unordered_map>
#include<set>
#include<queue>
#define int  long long
#define double long double
#define pb   push_back
#define mp   make_pair
#define pii  pair<int,int>
#define pip pair<int, pair<int, int> >
#define vip vector<pair<int, pii> >
#define vi vector<int>
#define vd vector<double>
#define mii  map<int, int>
#define qu queue<int>
#define set set<int>
#define multiset multiset<int>
#define rep(i, a, b) for(int i=a;i<b;i++)
#define rep1(i, a, b) for(int i=a;i>=b;i--)
#define viv vector<vi>
#define stack stack<int>
#define fi first
#define se second
#define reverse(s) reverse(s.begin(), s.end())
#define sort1(v) sort(v.begin(), v.end())
#define it iterator
#define pq priority_queue<int>
#define pq1 priority_queue <pii, vector<pii>, greater<pii> >
#define mem(x, y) memset(x, (int)y, sizeof(x))
#define ps(x,y) fixed<<setprecision(y)<<x
// author :: Anurag Anand.
using namespace std;
//int z=  1e9+7;
int z= 998244353;
int gcd(int a, int b){
    if(a==0)return b;
    if(b==0)return a;
    return gcd(b, a%b);
}
int power(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)
		{
			res=(res*a)%z;
			b--;
		}
		a=(a*a)%z;
		b=b>>1;
	}
	return res;
}
vi sv;
// vi seg;
// void arrange(int i, int v, int x, int lx, int rx){
// 	if(rx-lx==1){
// 		seg[x] =v;
// 		return;
// 	}
// 	int m= (lx+rx)/2;
// 	if(i<m) arrange(i, v, 2*x+1, lx, m);
// 	else arrange(i, v, 2*x+2, m, rx);
// 	seg[x]=min(seg[2*x+1], seg[2*x+2]);
// }
// int calc(int l, int r, int x, int lx, int rx){
// 	    if(l>=rx||r<=lx) return 1e9;
// 	    if(lx>=l&&rx<=r) return seg[x];
// 	    int mid=(lx+rx)/2;
// 	    int sl= calc(l, r, 2*x+1, lx, mid), sr= calc(l, r, 2*x+2, mid, rx);
// 	    return min(sl, sr);
// }
// vi v[200001];
// int dist[200001], ans[200001]={0}, vis[200001]={0};
// void dijkstra(int root){
// 	int a, d;
// 	dist[root]=0;
// 	set s;
// 	s.insert(mp(0, root));
// 	while(!s.empty()){
// 		a= (*s.begin()).se, d= (*s.begin()).fi;
// 		s.erase(s.begin());
// 		for(int i=0;i<v[a].size();i++){
// 			if(dist[a]+1<dist[v[a][i]]){
// 				s.erase(mp(dist[v[a][i]], v[a][i]));
// 				dist[v[a][i]]=dist[a]+1;
// 				s.insert(mp(dist[v[a][i]], v[a][i]));
// 			}
// 		}
// 	}
// }
vi pp;
int col[100001];
vi v[100001];
int g[100001]={0};
mii m;
void dfs(int u, int p=-1){
	m[col[u]]++;
	rep(i,0,v[u].size()){
		if(v[u][i]==p) continue;
		if(!m[col[v[u][i]]]){
			g[v[u][i]]=1;
		}
		dfs(v[u][i], u);
	}
	m[col[u]]--;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cout.tie(NULL);
	pp.assign(1000001, 0);
	for(int i=2;i<1000;i++){
		if(!pp[i]){
			for(int j=i*i;j<=1000000;j+=i){
				pp[j]=1;
			}
		}
	}
	for(int i=2;i<=1000000;i++) if(!pp[i]) sv.pb(i);
	int t;
	t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		rep(i,1,n+1) cin>>col[i];
		int x, y;
		rep(i,1,n){
			cin>>x>>y;
			v[x].pb(y);
			v[y].pb(x);
		}
		g[1]=1;
		dfs(1);
		rep(i,1,n+1) if(g[i]) cout<<i<<"\n";
	}
}