#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
inline long long pow(long long a, long long b, long long p) {
  long long rtn = 1;
  while (b) {
    if (b & 1) rtn = rtn * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return rtn;
}
void makedata() {
  freopen("input.txt", "w", stdout);
  srand((unsigned)time(NULL));
  fclose(stdout);
}
int d[500];
const long long mod = 1000000007;
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0);
  int n, x;
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> x;
    if (x != -1) d[x]++;
  }
  long long s = 0;
  for (int i = (1); i <= (n); i++) s = (s + pow(2, d[i], mod) - 1) % mod;
  cout << ((pow(2, n - 1, mod) - 1 - s + mod) % mod) << endl;
  return 0;
}
