#include <bits/stdc++.h>
const int mod = 1000000007;
int n, c[510], pw[510];
int main() {
  scanf("%d", &n);
  for (int i = n, a; i--;) scanf("%d", &a), a > -1 ? c[a]++ : 1;
  for (int i = *pw = 1; i < n; i++) pw[i] = pw[i - 1] * 2 % mod;
  int s = pw[n - 1] - 1;
  for (int i = n; i; i--) s = (s + mod - pw[c[i]] + 1) % mod;
  printf("%d\n", s);
}
