#include <bits/stdc++.h>
inline int read() {
  int r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
int n, f[555];
long long ans, p[555];
int main() {
  n = read();
  p[0] = 1;
  for (int i = 1; i <= n; i++) {
    int mast = read();
    if (~mast) f[mast]++;
    p[i] = p[i - 1] * 2 % 1000000007;
  }
  ans = p[n - 1] - 1;
  for (int i = 1; i <= n; i++) (ans += 1000000007 - p[f[i]] + 1) %= 1000000007;
  printf("%lld\n", ans);
  return 0;
}
