#include <bits/stdc++.h>
const int kN = 500 + 5;
const int MOD = (int)1e9 + 7;
int n;
int c[kN];
int pw2[kN];
int main() {
  pw2[0] = 1;
  for (int i = 1; i < kN; ++i) pw2[i] = pw2[i - 1] * 1LL * 2 % MOD;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (x == -1)
      ++c[i];
    else
      ++c[x - 1];
  }
  int result = (pw2[n - 1] + MOD - 1) % MOD;
  for (int i = 0; i < n; ++i)
    if (c[i] > 0) {
      (result += MOD - pw2[c[i] - 1] + 1) %= MOD;
    }
  printf("%d\n", result);
}
