#include <bits/stdc++.h>
using namespace std;
const int N = 505, M = 1e9 + 7;
int sub(int a, int b) {
  a -= b;
  if (a < 0) return a + M;
  return a;
}
int qpow(int a, int p) {
  int rt = 1, pa = a;
  for (; p; p >>= 1, pa = pa * 1ll * pa % M)
    if (p & 1) rt = rt * 1ll * pa % M;
  return rt;
}
int n;
inline void init() { scanf("%d", &n); }
int res;
int follower[N];
inline void solve() {
  res = sub(qpow(2, n - 1), 1);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    if (x != -1) follower[x]++;
  }
  for (int i = 1; i <= n; i++) res = sub(res, sub(qpow(2, follower[i]), 1));
  printf("%d\n", res);
}
int main() {
  init();
  solve();
  return 0;
}
