#include <bits/stdc++.h>
const int maxn = 507;
const int mod = 1E9 + 7;
int N, Pr[maxn], size[maxn];
int main() {
  Pr[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    Pr[i] = Pr[i - 1] * 2;
    if (Pr[i] >= mod) Pr[i] -= mod;
  }
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    int a;
    scanf("%d", &a);
    if (a > 0) ++size[a];
  }
  int tot = 0;
  for (int i = 1; i <= N; ++i)
    if (size[i]) {
      tot += Pr[size[i]];
      if (tot >= mod) tot -= mod;
      --tot;
      if (tot < 0) tot += mod;
    }
  tot = Pr[N - 1] - tot;
  --tot;
  if (tot < 0) tot += mod;
  printf("%d\n", tot);
}
