Snuke has a rooted tree with N+1 vertices.
The vertices are numbered 0 through N, and Vertex 0 is the root of the tree.
The parent of Vertex i (1 \leq i \leq N) is Vertex p_i.
Besides this tree, Snuke also has an box which is initially empty and many marbles, and playing with them.
The play begins with placing one marble on some of the vertices, then proceeds as follows:
 - If there is a marble on Vertex 0, move the marble into the box.
 - Move each marble from the vertex to its parent (all at once).
 - For each vertex occupied by two or more marbles, remove all the marbles from the vertex.
 - If there exists a vertex with some marbles, go to Step 1. Otherwise, end the play.
There are 2^{N+1} ways to place marbles on some of the vertices.
For each of them, find the number of marbles that will be in the box at the end of the play, and compute the sum of all those numbers modulo 1,000,000,007.

-----Constraints-----
 - 1 \leq N < 2 \times 10^{5}
 - 0 \leq p_i < i

-----Partial Scores-----
 - In the test set worth 400 points, N < 2{,}000.

-----Input-----
Input is given from Standard Input in the following format:
N
p_1 p_2 ... p_{N}

-----Output-----
Print the answer.

-----Sample Input-----
2
0 0

-----Sample Output-----
8

When we place a marble on both Vertex 1 and 2, there will be multiple marbles on Vertex 0 by step 2. In such a case, these marbles will be removed instead of being moved to the box.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from collections import deque\n\n\ndef get_pow():\n    cache = {}\n\n    def func(x):\n        if x not in cache:\n            cache[x] = pow(2, x, mod)\n        return cache[x]\n\n    return func\n\n\nmod = 1000000007\nn = int(input())\nparents = list(map(int, input().split()))\nchildren = [set() for _ in range(n + 1)]\nfor c, p in enumerate(parents):\n    children[p].add(c + 1)\n\nlevels = [{0}]\nwhile True:\n    level = set()\n    for p in levels[-1]:\n        level.update(children[p])\n    if not level:\n        break\n    levels.append(level)\nlevels.reverse()\n\nlevel_node_count = []\nballs = [None] * (n + 1)\n\nfor i, level in enumerate(levels):\n    level_node_count.append(len(level))\n    for node in level:\n        cn = children[node]\n        if cn:\n            if len(cn) == 1:\n                bs = balls[cn.pop()]\n                bs.appendleft([1, 1, 0])\n                balls[node] = bs\n                continue\n            balls_from_children = [balls[c] for c in children[node]]\n            balls_from_children.sort(key=len)\n            bs1 = balls_from_children[0]\n            for bs2 in balls_from_children[1:]:\n                for (b10, b11, b12), b2 in zip(bs1, bs2):\n                    b2[2] = ((b11 + b12) * b2[1] + b12 * b2[0]) % mod\n                    b2[1] = (b10 * b2[1] + b11 * b2[0]) % mod\n                    b2[0] = b2[0] * b10 % mod\n                bs1 = bs2\n            for b in bs1:\n                b[0] = (b[0] + b[2]) % mod\n                b[2] = 0\n            bs1.appendleft([1, 1, 0])\n            balls[node] = bs1\n        else:\n            balls[node] = deque([[1, 1, 0]])\n\nlevel_node_count.reverse()\n\npow2 = get_pow()\nprint((sum(b[1] * pow2(n - l + 1) % mod for l, b in zip(level_node_count, balls[0])) % mod))\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14873