#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
int a[510];
int pw[510], cnt[510];
int main() {
  pw[0] = 1;
  for (int i = 1; i < 510; i++) pw[i] = (INT)pw[i - 1] * 2 % 1000000007;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] != -1) cnt[a[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + pw[cnt[i]] - 1) % 1000000007;
  ans = (pw[n - 1] - 1 - ans) % 1000000007;
  ans = (ans + 1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}
