#include <bits/stdc++.h>
using namespace std;
const int maxn = 505;
int a[maxn];
int pw[maxn];
const int mod = 1e9 + 7;
int f(int x) {
  int res = 1 - pw[x - 1];
  res %= mod;
  res = (res + mod) % mod;
  return res;
}
int main() {
  pw[0] = 1;
  for (int i = (1); i < (maxn); ++i) pw[i] = pw[i - 1] * 2 % mod;
  int n;
  cin >> n;
  for (int i = (1); i < (n + 1); ++i) {
    int x;
    cin >> x;
    if (x != -1) a[x]++;
  }
  int ans = 0;
  for (int i = (1); i < (n + 1); ++i)
    if (a[i]) ans = (ans + f(a[i] + 1)) % mod;
  ans = (ans - f(n)) % mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;
  return 0;
}
