#include <bits/stdc++.h>
using namespace std;
const int inf32 = 0x3f3f3f3f;
const long long inf64 = 0x3f3f3f3f3f3f3f3f;
const int M = 1e9 + 7;
struct mint {
  int x;
  mint(int x = 0) : x(x) {}
  friend mint operator+(const mint a, const mint &b) {
    int x = a.x + b.x;
    return mint(x >= M ? x - M : x);
  }
  friend mint operator-(const mint a, const mint &b) {
    int x = a.x - b.x;
    return mint(x < 0 ? x + M : x);
  }
  friend mint operator*(const mint a, const mint &b) {
    return mint(1ll * a.x * b.x % M);
  }
};
int Pw(int a, int x = M - 2, int res = 1) {
  for (; x; x >>= 1, a = (mint(a) * a).x)
    if (x & 1) res = (mint(res) * a).x;
  return res;
}
const int N = 500;
int n, cnt[N], f[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    int x;
    cin >> x;
    if (~x) {
      --x;
      ++cnt[x];
    }
  }
  f[0] = 0;
  for (int i = (1); i < (n); ++i) {
    f[i] = (f[i - 1] * mint(2) - 1).x;
  }
  int now = 0;
  for (int i = (0); i < (n); ++i) {
    now = (mint(now) + f[cnt[i]]).x;
  }
  int res = (mint(now) - f[n - 1]).x;
  cout << res << '\n';
  return 0;
}
