function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s, y = this._y;
    s[y] = typeof s[y] === "string" ? s[y].split(" ") : s[y].reverse();
    this._y++;
    return f?s[y]:s[y].map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};

var mod = 1e9 + 7;
function abmod(){var a=arguments,r=a[0],i=1;for(;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}
function powmod(a,n){var r=1;while(n){if(n&1)r=abmod(a,r);a=abmod(a,a);n>>=1;}return r;}

var o = new gets(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a(), a = o.l();
  a.sort((a,b)=>a-b);
  var l = n % 2 ? 0 : 1;
  var r = (1 - l) * 2;
  for(var i = 0; i < n; i++){
    if(a[i] !== l)return 0;
    l += r;
    r = 2 - r;
  }
  return powmod(2, n >> 1);
}