There are $n$ startups. Startups can be active or acquired. If a startup is acquired, then that means it has exactly one active startup that it is following. An active startup can have arbitrarily many acquired startups that are following it. An active startup cannot follow any other startup.

The following steps happen until there is exactly one active startup. The following sequence of steps takes exactly 1 day.  Two distinct active startups $A$, $B$, are chosen uniformly at random.  A fair coin is flipped, and with equal probability, $A$ acquires $B$ or $B$ acquires $A$ (i.e. if $A$ acquires $B$, then that means $B$'s state changes from active to acquired, and its starts following $A$).  When a startup changes from active to acquired, all of its previously acquired startups become active. 

For example, the following scenario can happen: Let's say $A$, $B$ are active startups. $C$, $D$, $E$ are acquired startups under $A$, and $F$, $G$ are acquired startups under $B$: [Image]

Active startups are shown in red. 

If $A$ acquires $B$, then the state will be $A$, $F$, $G$ are active startups. $C$, $D$, $E$, $B$ are acquired startups under $A$. $F$ and $G$ have no acquired startups: $G$ 

If instead, $B$ acquires $A$, then the state will be $B$, $C$, $D$, $E$ are active startups. $F$, $G$, $A$ are acquired startups under $B$. $C$, $D$, $E$ have no acquired startups: [Image] 

You are given the initial state of the startups. For each startup, you are told if it is either acquired or active. If it is acquired, you are also given the index of the active startup that it is following.

You're now wondering, what is the expected number of days needed for this process to finish with exactly one active startup at the end.

It can be shown the expected number of days can be written as a rational number $P/Q$, where $P$ and $Q$ are co-prime integers, and $Q \not= 0 \pmod{10^9+7}$. Return the value of $P \cdot Q^{-1}$ modulo $10^9+7$.


-----Input-----

The first line contains a single integer $n$ ($2 \leq n \leq 500$), the number of startups.

The next line will contain $n$ space-separated integers $a_1, a_2, \ldots, a_n$ ($a_i = -1$ or $1 \leq a_i \leq n$). If $a_i = -1$, then that means startup $i$ is active. Otherwise, if $1 \leq a_i \leq n$, then startup $i$ is acquired, and it is currently following startup $a_i$. It is guaranteed if $a_i \not= -1$, then $a_{a_i} =-1$ (that is, all startups that are being followed are active).


-----Output-----

Print a single integer, the expected number of days needed for the process to end with exactly one active startup, modulo $10^9+7$.


-----Examples-----
Input
3
-1 -1 -1

Output
3

Input
2
2 -1

Output
0

Input
40
3 3 -1 -1 4 4 -1 -1 -1 -1 -1 10 10 10 10 10 10 4 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 3 3 3 3 3 3

Output
755808950



-----Note-----

In the first sample, there are three active startups labeled $1$, $2$ and $3$, and zero acquired startups. Here's an example of how one scenario can happen  Startup $1$ acquires startup $2$ (This state can be represented by the array $[-1, 1, -1]$)  Startup $3$ acquires startup $1$ (This state can be represented by the array $[3, -1, -1]$)  Startup $2$ acquires startup $3$ (This state can be represented by the array $[-1, -1, 2]$).  Startup $2$ acquires startup $1$ (This state can be represented by the array $[2, -1, 2]$). 

At this point, there is only one active startup, and this sequence of steps took $4$ days. It can be shown the expected number of days is $3$.

For the second sample, there is only one active startup, so we need zero days.

For the last sample, remember to take the answer modulo $10^9+7$.

```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 fractions import Fraction\nfrom copy import copy\nfrom random import randint\nfrom collections import *\nimport sys\nsys.setrecursionlimit(1500)\nclass F:\n    def __init__(self,m,n):\n        self.m = m\n        self.n = n\n        self.save = {}\n    def __call__(self,a):\n        if a in self.save:\n            return self.save[a]\n        if type(a) != Fraction:\n            a = Fraction(a)\n        m = self.m\n        n = self.n\n        if a == 0:\n            return Fraction(-0.5)\n        if a == 1:\n            return Fraction(-1)\n        self.save[a] = 2*f(a-1)-(a-2)*f(1)-1\n        return self.save[a]\ndef egcd(a, b):\n    if a == 0:\n        return (b, 0, 1)\n    else:\n        g, y, x = egcd(b % a, a)\n        return (g, x - (b // a) * y, y)\n\ndef modinv(a, m):\n    g, x, y = egcd(a, m)\n    if g != 1:\n        raise Exception('modular inverse does not exist')\n    else:\n        return x % m\n# print(estimate([2,1,0]))\n\nn = int(input())\narr = [int(x) for x in input().split()]\n# arr = [3,3,-1,-1,4,4,-1,-1,-1,-1,-1,10,10,10,10,10,10,4,20,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,3,3,3,3,3,3,3]\na = []\ncnt = defaultdict(int)\nfor x in arr:\n    cnt[x] += 1\nfor key in cnt:\n    cnt[-1] -= 1\ncnt[-1] += 1\nfor (key,value) in list(cnt.items()):\n    if key == -1:\n        for i in range(value):\n            a.append(1)\n    else:\n        a.append(value+1)\n# print(len(a),sum(a),a)\nn = len(a)\nm = sum(a)\nf = F(m,n)\n# for i in range(m+1):\n    # print(i,f(i))\nans = sum(f(x) for x in a)-f(m)\nMOD = 10**9+7\n# print(float(ans))\n# print(modinv(25025,MOD)*25025%MOD,ans.denominator)\nprint(ans.numerator*modinv(ans.denominator,MOD)%MOD)\n\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 179529