#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int Mod = 1e9 + 7;
const int maxn = 510;
int pw[maxn + 5];
int n;
int cnt[maxn + 5];
int main() {
  pw[0] = 1;
  for (int i = (0), i_end_ = (maxn); i < i_end_; ++i)
    pw[i + 1] = (pw[i] << 1) % Mod;
  scanf("%d", &n);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) {
    int first;
    scanf("%d", &first);
    if (~first) ++cnt[--first];
  }
  int ans = (pw[n - 1] + n - 1) % Mod;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) (ans -= pw[cnt[i]]) %= Mod;
  (ans += Mod) %= Mod;
  printf("%d\n", ans);
  return 0;
}
