#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-5;
const int maxn = 100000 + 10;
const int mod = 1e9 + 7;
int a, b[505], n;
int main() {
  memset(b, 0, sizeof(b));
  long long ans = 0;
  int tmp;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) ans = (2 * ans + 1) % mod;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    if (tmp >= 0) {
      ans -= (long long)b[tmp] + 1;
      b[tmp] = (2 * b[tmp] + 1) % mod;
    }
  }
  printf("%lld\n", (ans % mod + mod) % mod);
}
