#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, res, t[505];
int read() {
  int x = 0, fl = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') fl = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * fl;
}
int qpow(int base, int pw) {
  int s = 1;
  while (pw) {
    if (pw & 1) s = 1ll * s * base % mod;
    base = 1ll * base * base % mod;
    pw >>= 1;
  }
  return s;
}
int g(int x) { return qpow(2, x) - 1; }
int main() {
  n = read(), res = g(n - 1);
  for (int i = 1; i <= n; i++) {
    int x = read();
    if (x != -1) t[x]++;
  }
  for (int i = 1; i <= n; i++) res = (res - g(t[i]) + mod) % mod;
  printf("%d\n", res);
  return 0;
}
