#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
int O[maxn << 2], laz[maxn << 2], L[maxn], R[maxn], init[maxn];
vector<int> mp[maxn];
int tot, x, y, z;
void dfs(int now, int fa) {
  L[now] = ++tot;
  for (int i = 0; i < mp[now].size(); i++) {
    if (mp[now][i] == fa) continue;
    dfs(mp[now][i], now);
  }
  R[now] = tot;
}
void build(int o, int l, int r) {
  if (l == r)
    O[o] = init[l];
  else {
    int mid = l + (r - l) / 2;
    build(o * 2, l, mid);
    build(o * 2 + 1, mid + 1, r);
    O[o] = O[o * 2] + O[o * 2 + 1];
  }
}
void push_down(int o, int l, int mid, int r) {
  if (laz[o] > 0) {
    laz[o * 2] ^= 1;
    laz[o * 2 + 1] ^= 1;
    O[o * 2] = (mid - l + 1) - O[o * 2];
    O[o * 2 + 1] = r - mid - O[o * 2 + 1];
    laz[o] = 0;
  }
}
void update(int o, int l, int r) {
  if (l >= x && r <= y) {
    laz[o] ^= 1;
    O[o] = (r - l + 1) - O[o];
  } else {
    int mid = l + (r - l) / 2;
    push_down(o, l, mid, r);
    if (x <= mid) update(o * 2, l, mid);
    if (y > mid) update(o * 2 + 1, mid + 1, r);
    O[o] = O[o * 2] + O[o * 2 + 1];
  }
}
int query(int o, int l, int r) {
  if (l >= x && r <= y)
    return O[o];
  else {
    int mid = l + (r - l) / 2, ans = 0;
    push_down(o, l, mid, r);
    if (x <= mid) ans += query(o * 2, l, mid);
    if (y > mid) ans += query(o * 2 + 1, mid + 1, r);
    return ans;
  }
}
int main() {
  int n, p, q, fa;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa);
    mp[fa].push_back(i);
    mp[i].push_back(fa);
  }
  tot = 0;
  dfs(1, -1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p);
    init[L[i]] = p;
  }
  build(1, 1, n);
  scanf("%d", &q);
  while (q--) {
    char op[10];
    scanf("%s %d", op, &p);
    x = L[p];
    y = R[p];
    if (op[0] == 'g')
      printf("%d\n", query(1, 1, n));
    else
      update(1, 1, n);
  }
  return 0;
}
