#include <bits/stdc++.h>
using namespace std;
int bit[510];
int u, cnt[510], n;
int main() {
  scanf("%d", &n);
  bit[0] = 1;
  for (int i = 1; i <= n; i++) bit[i] = (bit[i - 1] << 1) % 1000000007;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &u);
    if (u != -1) cnt[u]++;
  }
  int ans = bit[n - 1] - 1;
  for (int i = 1; i <= n; i++) {
    ans = (ans - (bit[cnt[i]] - 1)) % 1000000007;
  }
  printf("%d", (ans + 1000000007) % 1000000007);
}
