C. Painting a Tree
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Cow the Cow has a tree of size $$$n$$$ rooted at node $$$1$$$. However, Cow the Nerd thinks that Cow the Cow's tree is boring, so he has assigned you the task of painting it.

Specifically, let your current position be $$$u$$$. In a move, you will do one of the following:

  • If $$$u$$$ is a leaf$$$^\dagger$$$ and all other nodes have been painted, then you paint $$$u$$$ and escape. Otherwise, paint $$$u$$$, choose any non-painted node, and move there.
  • If $$$u$$$ is not a leaf and all of its children have been painted, then you are trapped in the tree and fail the task. Otherwise, paint $$$u$$$ and move to any of its non-painted children.

For every node $$$u$$$ from $$$1$$$ to $$$n$$$, find out if it is possible to paint all nodes of the tree and escape successfully if you start from node $$$u$$$.

$$$^\dagger$$$A leaf of a rooted tree is a node that is not the root and has no children.

Input

The first line contains exactly one integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^5)$$$.

The second line contains $$$n - 1$$$ integers $$$p_2, p_3, ..., p_n$$$, where $$$p_i$$$ is the parent of the $$$i$$$-$$$th$$$ node.

It is guaranteed that the input provides a valid tree.

Output

Output a binary string $$$s$$$ of size $$$n$$$, where $$$s_i = 1$$$ if you can win starting from node $$$i$$$, and $$$s_i = 0$$$ otherwise.

Examples
Input
5
1 1 1 1
Output
11111
Input
2
1
Output
10
Input
6
1 1 2 3 4
Output
111000
Note

In the first example, no matter which node you start from, there's at least one possible winning sequence of moves.

In the second example, if you start from node $$$2$$$, there's only one possible sequence of moves: paint node $$$2$$$, and since it is a leaf, move to the only unpainted node, $$$1$$$. Node $$$1$$$ is not a leaf, and all of its children have been painted; therefore, you lose.