#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, a[507], sze[507], ans;
long long ksm(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1) res = res * a % mod;
  return res;
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] != -1) sze[a[i]]++;
  }
  for (long long i = 1; i <= n; ++i)
    if (sze[i]) ans = (ans + ksm(2, sze[i]) - 1) % mod;
  printf("%lld", (ksm(2, n - 1) - 1 - ans + mod) % mod);
  return 0;
}
