#include <bits/stdc++.h>
using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
std::mt19937_64 rands;
ul n;
vul ans(501, 1);
const ul base = 1e9 + 7;
ul plus(ul a, ul b) { return a + b < base ? a + b : a + b - base; }
ul minus(ul a, ul b) { return a < b ? a + base - b : a - b; }
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  rands.seed(std::time(0));
  std::cin >> n;
  ul a = 1;
  for (ul i = 0; i != n; ++i) {
    li temp;
    std::cin >> temp;
    if (~temp) {
      ans[temp] = plus(ans[temp], ans[temp]);
    }
    if (i) {
      a = plus(a, a);
    }
  }
  for (ul i = 1; i <= n; ++i) {
    a = plus(minus(a, ans[i]), 1);
  }
  a = minus(a, 1);
  std::cout << a << std::endl;
  return 0;
}
