#include <bits/stdc++.h>
inline int fmo(int x) { return x + ((x >> 31) & 1000000007); }
inline int fp(int x, int k) {
  int res = 1;
  for (; k; k >>= 1, x = 1ll * x * x % 1000000007)
    if (k & 1) res = 1ll * res * x % 1000000007;
  return res;
}
int n;
int cnt[505];
int ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    if (a > 0) cnt[a]++;
  }
  ans = fmo(fp(2, n - 1) - 1);
  for (int i = 1; i <= n; i++) {
    ans = fmo(ans - fp(2, cnt[i]));
    ans = fmo(ans + 1 - 1000000007);
  }
  printf("%d\n", ans);
}
