#include <bits/stdc++.h>
using namespace std;
int n;
long long qp(long long x, long long y) {
  long long r = 1;
  for (; y; y >>= 1, x = x * x % 1000000007ll)
    if (y & 1) r = r * x % 1000000007ll;
  return r;
}
long long c[1000010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (~x) c[x]++;
  }
  long long r = 0;
  for (int i = 1; i < 10010; i++)
    r = (r + qp(2, c[i]) - 1 + 1000000007ll) % 1000000007ll;
  cout << (qp(2, n - 1) - 1 - r + 1000000007ll) % 1000000007ll;
}
