#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
inline int power(int a, int b) {
  int out = 1;
  while (b) {
    if (b & 1) out = (long long)out * a % mod;
    a = (long long)a * a % mod;
    b >>= 1;
  }
  return out;
}
int n, cnt[510];
int main() {
  scanf("%d", &n);
  for (int i = 1, a; i <= n; i++) {
    scanf("%d", &a);
    if (a > 0) cnt[a]++;
  }
  int t = 0;
  for (int i = 1; i <= n; i++)
    if (cnt[i]) t = (t + power(2, cnt[i]) - 1) % mod;
  printf("%d\n", (power(2, n - 1) - t - 1 + mod) % mod);
  return 0;
}
