#include <bits/stdc++.h>
using namespace std;
long long s[110000], a[110000];
int main() {
  int n;
  scanf("%d", &n);
  a[0] = 1;
  for (int i = 1; i <= 500; i++) a[i] = a[i - 1] * 2 % 1000000007;
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (x != -1) s[x]++;
  }
  long long now = 0;
  for (int i = 1; i <= n; i++)
    if (s[i] > 0) {
      now = now + a[s[i]] - 1;
      now = (now % 1000000007 + 1000000007) % 1000000007;
    }
  long long ans = a[n - 1] - 1 - now;
  ans = (ans % 1000000007 + 1000000007) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
