#include <bits/stdc++.h>
using namespace std;
const int N = 510, P = 1e9 + 7;
int n, x, pw[N], cnt[N];
int main() {
  scanf("%d", &n);
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 2 % P;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (~x) cnt[x]++;
  }
  int ans = pw[n - 1] - 1;
  for (int i = 1; i <= n; i++) ans = (ans - (pw[cnt[i]] - 1)) % P;
  printf("%d\n", (ans + P) % P);
  return 0;
}
