#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int cnt[505];
long long pow2[505];
int main() {
  int n, id;
  long long ans;
  scanf("%d", &n);
  memset(cnt, 0, sizeof(cnt));
  pow2[0] = 1;
  for (int i = 1; i <= n; i++) {
    pow2[i] = pow2[i - 1] * 2 % mod;
    scanf("%d", &id);
    if (~id) cnt[id]++;
  }
  ans = (pow2[n - 1] - 1 + mod) % mod;
  for (int i = 1; i <= n; i++) ans = (ans - pow2[cnt[i]] + 1 + mod) % mod;
  printf("%I64d\n", ans);
  return 0;
}
