#include <iostream>
using namespace std;
struct ChildNode
{
int child;
struct ChildNode *next;
};
struct ParentNode
{
int i;
struct ChildNode *next;
};
int Count(char *color, struct ParentNode *arr, int i)
{
int count = 0;
if (color[i] == 'R')
{
count++;
}
struct ChildNode *p = arr[i].next;
while(p != NULL)
{
count += Count(color, arr, p->child);
p = p->next;
}
return count;
}
int main()
{
int n = 0;
cin >> n;
int a = 0;
int q = 0;
struct ParentNode arr[n];
struct ChildNode *z;
for (int i = 0; i < n; i++)
{
arr[i].i = 0;
arr[i].next = NULL;
}
for (int i = 1; i < n; i++)
{
cin >> a;
struct ChildNode *p = new struct ChildNode;
p->child = i;
p->next = NULL;
z = arr[a-1].next;
if (z == NULL)
{
arr[a-1].next = p;
}
else
{
while(z->next != NULL)
{
z = z->next;
}
z->next = p;
}
}
char color[n+1];
cin >> color;
for (int j = 0; j < n; j++){
arr[j].i = Count(color, arr, j);
}
cin >> q;
int x = 0;
while(q--)
{
cin >> x;
cout << arr[x-1].i << endl;
}
return 0;
}