Problem: Consider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex u is called a child of vertex v and vertex v is called a parent of vertex u if there exists a directed edge from v to u. A vertex is called a leaf if it doesn't have children and has a parent.

Let's call a rooted tree a spruce if its every non-leaf vertex has at least 3 leaf children. You are given a rooted tree, check whether it's a spruce.

The definition of a rooted tree can be found [here](https://goo.gl/1dqvzz).

Input

The first line contains one integer n — the number of vertices in the tree (3 ≤ n ≤ 1 000). Each of the next n - 1 lines contains one integer pi (1 ≤ i ≤ n - 1) — the index of the parent of the i + 1-th vertex (1 ≤ pi ≤ i).

Vertex 1 is the root. It's guaranteed that the root has at least 2 children.

Output

Print "Yes" if the tree is a spruce and "No" otherwise.

Examples

Input

4
1
1
1


Output

Yes


Input

7
1
1
1
2
2
2


Output

No


Input

8
1
1
1
1
3
3
3


Output

Yes

Note

The first example:

<image>

The second example:

<image>

It is not a spruce, because the non-leaf vertex 1 has only 2 leaf children.

The third example:

<image>

Solution (in PYTHON3):

Solution:
#x is the number of yellow balls, y is the number of green balls, z is the number of blue balls needed.
#y is the number of green balls

'''
yel, b = [int(el) for el in input().split(' ')]
x, y, z = [int(ball) for ball in input().split(' ')]

yel_req = x * 2 + y * 1
b_req = y * 1 + z * 3

yel_req = max(0, yel_req-yel)
b_req = max(0, b_req-b)
print(yel_req+b_req)
'''


'''
# http://codeforces.com/contest/913/problem/0
n = int(input())
m = int(input())

print(m % 2**n)
'''

from collections import defaultdict
import sys

# http://codeforces.com/contest/913/problem/B
n = int(input())
# every vertex except the root has a unique parent

arr = []
for i in range(n-1):
	arr.append(int(input()))

d = defaultdict(list)
i = 1
for el in arr:
	i += 1
	j = d.get(el)
	if j == []:
		d[el] = [i]
	else:
		d[el].append(i)
# {1: [2,3,4], 2:[5,6,7]}

#print(d)
for par in d:
	in_root = 0
	for el in d[par]:
		j = d.get(el)
		if j:
			in_root += 1
	#print("parent: {0}, n_chdrn: {1}, n_in_root: {2}".format(par, len(d[par]), in_root))
	if len(d[par]) - in_root < 3:
		print("No")
		sys.exit()
print("Yes")