#include <bits/stdc++.h>
using namespace std;
#define sz(a) ((int)(a.size()))
#define all(a) a.begin(), a.end()
#define rep(i, a, n) for(int i = a; i < n; i++)
const uint32_t N = 2e5 + 1;
int arr[N], timer = 0;
vector<int> tin(N), tout(N), who(2 * N + 1);
void dfs(int v, int par, vector<int> G[]) {
tin[v] = ++timer;
who[tin[v]] = v;
for(int u : G[v]) {
if(u != par) dfs(u, v, G);
}
tout[v] = ++timer;
}
class segment_tree {
vector<int> sgtree, lazy; int n;
public:
void build(int l, int r, int node, vector<int> &a) {
if(l == r) {
sgtree[node] = arr[who[a[l]]]; return void();
}
int mid = (l + r) / 2;
build(l, mid, 2 * node + 1, a);
build(mid+1, r, 2 * node + 2, a);
sgtree[node] = sgtree[2 * node + 1] + sgtree[2 * node + 2];
}
int query(int i, int j, int l, int r, int node) {
if(r < i or l > j) return 0;
if(lazy[node]%2) {
sgtree[node] = j - i + 1 - sgtree[node];
if(i != j) {
lazy[2 * node + 1] += lazy[node];
lazy[2 * node + 2] += lazy[node];
}
lazy[node] = 0;
}
if(i >= l and j <= r) return sgtree[node];
int mid = (i + j) / 2;
int a = query(i, mid, l, r, 2 * node + 1);
int b = query(mid+1, j, l, r, 2 * node + 2);
return a + b;
}
void update(int i, int j, int l, int r, int node, int val) {
if(j < l or i > r) return void();
if(lazy[node]%2) {
sgtree[node] = j - i + 1 - sgtree[node];
if(i != j) {
lazy[2 * node + 1] += lazy[node];
lazy[2 * node + 2] += lazy[node];
}
lazy[node] = 0;
}
if(i >= l and j <= r) {
sgtree[node] = j - i + 1 - sgtree[node];
if(i != j) {
lazy[2 * node + 1] += val;
lazy[2 * node + 2] += val;
}
return void();
}
int mid = (i + j) / 2;
update(i, mid, l, r, node * 2 + 1, val);
update(mid+1, j, l, r, node * 2 + 2, val);
sgtree[node] = sgtree[2 * node + 1] + sgtree[2 * node + 2];
}
void build (vector<int> &a) {
this->n = (int)(a.size());
sgtree.resize(4*n); lazy.resize(4*n);
build(0, n-1, 0, a);
}
void update (int l, int r, int val) {
update(0, n-1, l, r, 0, val);
}
int query (int l, int r) {
return query(0, n-1, l, r, 0);
}
};
int get_id(int val, vector<int> &T) {
int ans = sz(T) - 1, l = 0, r = ans;
while (l <= r) {
int m = (l + r) / 2;
if (T[m] <= val) {
ans = m; l = m + 1;
} else {
r = m - 1;
}
}
return ans;
}
signed main()
{
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
rep(i, 1, n + 1) cin >> arr[i];
vector<int> G[n+1];
for(int i = 0; i < n-1; i++) {
int u, v; cin >> u >> v;
G[u].push_back(v); G[v].push_back(u);
}
dfs(1, 0, G);
vector<int> stin;
rep(i, 1, n + 1) stin.push_back(tin[i]);
sort(all(stin));
segment_tree st; st.build(stin);
int q; cin >> q;
while(q--) {
int type, v; cin >> type >> v;
if(type == 1) {
st.update(get_id(tin[v], stin), get_id(tout[v], stin), 1);
} else {
cout << st.query(get_id(tin[v], stin), get_id(tout[v], stin)) << '\n';
}
}
return 0;
}