#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class Zoo { public:
	long long theCount(vector <int> answers) 
	{
		map<int,int> nc;
		for(int i=0; i<answers.size(); ++i)
			nc[answers[i]] ++;

		int two = 0;
		int one = 0;
		for(int k=0 ;; ++k)
			if( nc[k] == 2 )
				two++;
			else if( nc[k] == 1 )
			{
				for(;; ++k)
					if( nc[k] == 1 )
						one++;
					else if( nc[k] == 0 )
						break;
					else
						return 0LL;
				break;
			}
			else if( nc[k] == 0 )
				break;
			else
				return 0LL;
		if( two*2 + one != answers.size() )
			return 0LL;
		LL r = 2;
		for(int i=0; i<two; ++i)
			r = r*2;
		return r;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const long long& Expected, const long long& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, Zoo().theCount(answers));}
int main(){

CASE(0)
	int answers_[] = {0, 1, 2, 3, 4};
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = 2LL; 
END
CASE(1)
	int answers_[] = {5, 8};
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = 0LL; 
END
CASE(2)
	int answers_[] = {0, 0, 0, 0, 0, 0};
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = 0LL; 
END
CASE(3)
	int answers_[] = {1, 0, 2, 0, 1};
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = 8LL; 
END
CASE(4)
	int answers_[] = {1, 0, 1};
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = 0LL; 
END
/*
CASE(5)
	int answers_[] = ;
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = LL; 
END
CASE(6)
	int answers_[] = ;
	  vector <int> answers(answers_, answers_+sizeof(answers_)/sizeof(*answers_)); 
	long long _ = LL; 
END
*/
}
// END CUT HERE
