#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
int n, a[505], S[505];
int F(int x) {
  int s = 1;
  for (int i = (int)(1); i <= (int)(x); i++) s = 2ll * s % mo;
  return s - 1;
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", &a[i]);
  for (int i = (int)(1); i <= (int)(n); i++) ++S[max(a[i], 0)];
  int ans = F(n - 1);
  for (int i = (int)(1); i <= (int)(n); i++)
    if (a[i] == -1) ans = (ans + mo - F(S[i])) % mo;
  printf("%d\n", ans);
}
