#include <bits/stdc++.h>
using namespace std;
long long int pi = 1000000007;
long long int p2[502];
int main() {
  p2[0] = 1;
  for (int i = 1; i < 502; i++) {
    p2[i] = (p2[i - 1] * 2) % pi;
  }
  int n;
  cin >> n;
  vector<int> a;
  a.assign(n + 2, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x + 1) {
      a[x]++;
    } else
      a[i + 1]++;
  }
  long long int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (a[i]) ans += (p2[a[i] - 1] - 1);
  }
  long long int fians = (((p2[n - 1] - 1) - ans) % pi);
  if (fians < 0) fians += pi;
  cout << fians << endl;
}
