#include <bits/stdc++.h>
int const mod = 1e9 + 7;
inline int fpow(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) ans = 1ll * ans * a % mod;
  return ans;
}
int n, c[510], ans;
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    if (~x) ++c[x];
  }
  for (int i = 1; i <= n; i++) ans = (ans + 1 - fpow(2, c[i]) + mod) % mod;
  ans = (ans + fpow(2, n - 1) - 1) % mod;
  if (ans < 0) ans += mod;
  printf("%d\n", ans);
  return 0;
}
