#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long QuickPow(long long x, long long p) {
  long long base = x, ans = 1;
  while (p) {
    if (p & 1) ans *= base, ans %= MOD;
    p >>= 1;
    base *= base;
    base %= MOD;
  }
  return ans;
}
long long n, deg[505];
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) {
    long long x;
    scanf("%lld", &x);
    if (~x) ++deg[x];
  }
  long long ans = 0;
  for (long long i = 1; i <= n; ++i)
    if (deg[i]) ans += QuickPow(2, deg[i]) - 1, ans %= MOD;
  printf("%lld", (((QuickPow(2, n - 1) - 1) % MOD - ans) + MOD) % MOD);
  return 0;
}
