n = int(input())
parents = list(map(int, input().split()))
# 树的表示
tree = [[] for _ in range(n+1)]
for i, p in enumerate(parents):
i = i + 2
tree[p].append(i)
WRs = input()
dp = [0] * (n + 1)
for i, c in enumerate(WRs):
if c == 'R':
dp[i + 1] = 1
# 深度优先搜索
def dfs(i):
if tree[i] == []:
return
for k in tree[i]:
dfs(k)
for k in tree[i]:
dp[i] += dp[k] # 累加所有子树的R个数
dfs(1)
q = int(input())
for i in range(q):
x = int(input())
print(dp[x])