#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

ll mod = 1e9 + 7;

int main() {
  int N;
  cin >> N;

  vector<int> v(N, 0);
  rep(i, N) {
    int a;
    cin >> a;
    v[a]++;
  }

  if (N % 2 != 0 && v[0] != 1) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  for (int i = 1; i < N; i++) {
    if (v[i] == 0)
      continue;
    if (v[i] != 2) {
      ans = 0;
      break;
    }
    ans = 2 * ans % mod;
  }

  cout << ans << endl;
}