#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510;
const int mod = 1e9 + 7;
long long n, p[MAXN], a[MAXN], S, T, x;
long long read() {
  long long x = 0, sgn = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') sgn = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
  return x * sgn;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    x = read();
    if (x != -1) a[x]++;
  }
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++)
    if (a[i] > 0) S = (S + p[a[i]] - 1) % mod;
  T = p[n - 1] - 1;
  printf("%lld\n", ((T - S) % mod + mod) % mod);
  return 0;
}
