stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
/*	MASTER HAS FAILED MORE TIMES

	THAN BEGINNER HAS EVER TRIED

*/



#include <bits/stdc++.h>



using namespace std;



#define endl            '\n'

#define mem(a, n)       memset(a, n, sizeof(a))

#define repeat(n)       for(int i=0; i<n; i++)

#define Unique(n)       (n).erase(unique(all(n)), (n).end())

#define isPowerOfTwo(n) (n && !(n & (n - 1)))

#define NumofDigits(n)  ((int)log10(n)+1)

#define all(a)          a.begin(), a.end()



unsigned long long pow(long long base, long long power);



long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }

long long lcm(long long a, long long b){ return a*b/gcd(a, b); }



void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }



/*

    Special functions:

        find_by_order(k) --> returns iterator to the kth largest element counting from 0

        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item

*/



int main(){

    quicken();



    long long n, ans=LLONG_MAX; cin >> n;

    for(int i=1; i<=sqrt(n); i++)

        if(!(n%i))

            ans = min(ans, i+n/i-2);



    cout << ans;



    return 0;

}



unsigned long long pow(long long base, long long power){

    if(power==0) return 1;

    if(power==1) return base;



    unsigned long long ans = pow(base, power/2);

    ans *= ans; /// ans = (ans%mod)*(ans%mod);



    if(power&1) return ans*base; /// (ans%mod)*(base%mod);

    return ans;

}


// Faster C++ solution for the same problem (measured speedup: 4.332413671220869x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;





int main()

{

    long long n ;   cin>>n ;

    long long ans=n;

    int sq=sqrt(n);

    for(int i=1 ; i<=sq ;i++)

    {

        if(n%i==0)

            ans = min(ans , i+n/i-2);

    }

    cout<<ans ;

}

// Faster C++ solution for the same problem (measured speedup: 4.222838737838514x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define fori( tt,aa)      for(long long i= tt; i<aa; i++)

#define forj( yy,bb)      for(long long j=yy; j<bb; j++)

#define fork( uu,cc)      for(long long k=uu; k<cc; k++)

#define sz(v)    v.size()

#define all(v)   v.begin(), v.end()

#define endl "\n";

#define pb push_back

#define pf push_front

#define popb pop_back

#define popf pop_front

#define EPS 1e-7

#define F first

#define S second

#define THINK_TWICE_CODE_ONCE; fast();



typedef long long ll;

typedef long double ld;

typedef double dd;

typedef string String;

typedef string str;

typedef vector<int> vecint;

typedef vector<ll> vecll;

typedef pair<int, int> pii;





void accuSum2D(vector<vector<int>>&a){

    //accumulate each row

    fori(1, 101)

     forj(1, 101)

        a[i][j] +=a[i][j-1];



    //accumulate each col

    forj(1, 101)

     fori(1, 101)

        a[i][j] +=a[i-1][j];

}



int sum_range(int i, int j, int k, int l, vector<vector<int>>&s){

    return s[k][l] - s[k][j-1] - s[i-1][l] + s[i-1][j-1];

}



void fast(){

    cin.tie(0);

    cout.tie(0);

    cin.sync_with_stdio(0);

}



ld pow (ll a, ll b);

ll numOfDigits(ll n);

int main()

{

    THINK_TWICE_CODE_ONCE;

    //freopen("great Vova Wall1.txt", "r", stdin);

    ll n; cin>>n;

    ll sq = sqrt(n);

    ll mn = n-1;

    fori(1, sq+1){

        if(!(n%i)){

            ll div = n/i;

            ll mn2 = min(div, i), mx2 = max(div, i);

            mn = min(mn, mx2 + mn2 -2);

        }

    }

    cout<<mn;

    return 0;

}

ld pow (ll a, ll b){

    ld pow = 1;

    fori(0,b)

        pow *=a;

    return pow;

}



ll numOfDigits(ll n){

    if(!n) return 1;

    return (ll)(log10(n)+1);

}


// Faster C++ solution for the same problem (measured speedup: 4.288973409713148x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2e5+10 , OO = 0x3f3f3f3f;



#define clr(arr,val) memset(arr , val , sizeof (arr))

#define loop(i,n) for(int i = 0;i < int(n);i++)

#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)

#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)

#define range(n) for(int &x : n) cin >> x;

#define ALL(v) ((v).begin()) , ((v).end())

#define SZ(v)  ((int)((v).size()))

typedef pair <int,int> pii ;

typedef vector < pii > vii ;

typedef vector < int > vi;

int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//freopen("input.txt", "r", stdin);

//freopen("output.txt", "w", stdout);





int n;





int main()

{   



      ios_base::sync_with_stdio(0) , cin.tie(0);cout.tie(0);





      ll n;

      cin >> n;

      ll ans = 1e18;

      for (ll i=1 ;i*i<=n;i++) {

            ll div = n/i;

            if ( i*div == n) 

                  ans = min(ans,i+div-2);

      }

      cout << ans << endl;





      return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.329575928917037x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"

#include "sstream"

#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

const int N=1e5+1;

const double EulerConstant = exp(-1);

int main() {

        quick

long long ans=LONG_LONG_MAX,n; cin>>n;

for(long long i=1;i*i<=n;i++){

    if(n%i==0){

        if(n/i==i){ans=min(ans,(i-1)+(n/i-1));}

        else{

            ans=min(ans,(i-1)+(n/i-1));

            ans=min(ans,(n/i-1)+(n-1));

        }

    }

}

cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 4.312432839131019x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



#define pb push_back

#define F first

#define S second

#define fo(i,a,b)  for(int i = a; i < b; i++)



using ll = long long;

using ld = long double;

using ul = unsigned long long;

using ii = pair<int, int>;

#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define ReadFile            freopen("input.in","r",stdin)

#define WriteFile           freopen("output.txt","w",stdout)

const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;

const ld EPS = 1e-7;

double Pi=acos(-1);

const ld rad=Pi/180.0;

ll power(ll x, ll y, ll p)

{

    ll res = 1;

    while (y > 0)

    {

        if (y & 1)

            res = (res*x) % p;

        y = y>>1;

        x = (x*x) % p;

    }

    return res;

}

ll nCr (ll n,ll m)

{

        return(m == 0)?1:n*nCr(n-1,m-1)/m;

}

/*****************************************************/



int main()

{

    ll n, ans= 1e12;

    cin >> n;

    

    for(ll i=1;i*i<=n;i++){

        if(n%i==0)

            ans=min(ans,(i+n/i));

    }



     cout << ans-2 << endl;





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.259929823847339x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long n,mx=0;

    cin >> n;

    long long i,arr[10000];

    for(i=sqrt(n)+1;i>0;i--)

    {

        if(n%i==0)

        {

            mx=i;

            break;

        }

    }

    cout << mx-1 + n/mx-1 << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.1823171861740605x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
/*

Md.Shahnewaz Siddique Labib

Dept. of CSE

IUT,19

*/

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);

#define vi vector<int>

#define pii pair<int, int>

#define vpii vector<pair<int, int>>

#define ll long long

#define ld long double

#define pb push_back

#define mp make_pair



using namespace std;



int main(){

    fastio;

    ll n, moves;

    cin >> n;

    moves = n;

    for(long long i = 1; i*i < n + 1; i++) if(n%i == 0) moves = min(moves, i + n/i - 2);

    cout << moves;

}


// Faster C++ solution for the same problem (measured speedup: 4.31359529854879x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int main() {

    uint64_t n;

    cin >> n;



    uint64_t minima = UINT64_MAX;

    for (uint64_t x = 1; x*x <= n; x++) {

        if (n % x == 0) {

            uint64_t y = n / x;

            minima = min(minima, (x + y - 2));

        }

    }



    cout << minima << endl;

}

// Faster C++ solution for the same problem (measured speedup: 4.207907003159423x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int main()

{

    long long n  , sum=1e18;

    cin>>n;

    for(int i=1 ; i<=sqrt(n) ; i++)

    {

        if( n%i==0 )

        {

            sum=min( sum , ( ( i-1 )+ ( (n/i) -1 ) ) );

        }

    }

    cout<<sum<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.279040080577082x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cmath>

#include<math.h> 

#include<cstring>

#include<iostream>

#include<algorithm>

#define pi acos(-1);

#define MAX 1e5;

using namespace std;

typedef long long ll;

int main()

{

	ll N;

	float a;

	ll b;

	cin >> N;

	int n = sqrt(N)+1;

	ll ans=0;

	//cout << n;

	for(ll i=1;i<=n;i++){

		a = N / (i*1.0);

		b = N / i;

		if (N % i==0) {

			if (ans == 0)ans = (i + b - 2);

			else ans = (ans > (i + b - 2)) ? (i + b - 2) : ans;

		}

	}

	cout << ans;

}

// Faster C++ solution for the same problem (measured speedup: 4.222678099198984x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main(){

    long long int n,i,j,d=1,ans;

    cin>>n;

    for(i=2;i<=(int)sqrt(n);i++){

        if(n%i==0){d=i;}

    }

    ans=d+n/d-2;

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.360462495910905x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ms(x,y) memset(x, y, sizeof(x))

#define lowbit(x) ((x)&(-x))

#define sqr(x) ((x)*(x))

typedef long long LL;

typedef pair<int,int> pii;

typedef pair<LL,LL> pll;





void run_case() {

    LL n; cin >> n;

    LL x = n+1, y = n+1;

    for(LL i = 1; i*i <= n; ++i) {

        if(n % i == 0) {

            LL nx = i, ny = n / i;

            if(nx + ny < x + y) x = nx, y = ny;

        }

    }

    cout << (x+y-2);

}





int main() {

    ios::sync_with_stdio(false), cin.tie(0);

    cout.flags(ios::fixed);cout.precision(9);

    //int t; cin >> t;

    //while(t--)

    run_case();

    cout.flush();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.31354034695179x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

using namespace std;

//ll s[500500];

//const int N=1e7+5;

//ll f[N],n,ans;

int main(){

   ll n;

  cin >> n;

  ll ans = n - 1;

  for (ll i = 1; i * i <= n; i++) {

    if (n%i)continue;

    ll j = n / i;

    ans = min(ans, i + j - 2);

  }

  cout << ans << "\n";

}






// Faster C++ solution for the same problem (measured speedup: 4.26257603085639x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main() {

    long long int n,sum;



    cin>>n;

    sum=n-1;

    for(long long int i=1;i*i<=n;i++){

        if(n%i==0){

            long long int minsum=i+n/i-2;

            if(sum>minsum)

                sum=minsum;

        }

    }

    cout<<sum;







    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.253155590555302x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

#include<algorithm>

using namespace std;

typedef long long ll;

int main()

{

    ll n;

    cin >> n;

    ll ans=0;

    for(ll i=1;i*i<=n;i++)

    {

        if(n%i==0)

        {

            ans = i;

        }

    }

    cout << (ans-1)+(n/ans-1);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.253116403224927x):
#include <cstdio>

#include <cmath>

#define ll long long

using namespace std;

int main(){

    ll n,k;

    scanf("%lld",&n);

    k=ceil(sqrt(n));

    while(k){

        if(n%k==0){

            printf("%lld",k-1+n/k-1);

            return 0;

        }

        k--;

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



const int N = 200010;

typedef long long ll;



ll dp[N][5];

int a[N];



void update(ll &a, ll b){

    if (a == -1 || a > b){

        a = b;

    }

}



int main(){

    int n;

    scanf("%d", &n);

    for (int i = 1; i <= n; ++ i){

        scanf("%d", &a[i]);

    }

    memset(dp, -1, sizeof(dp));

    dp[0][0] = 0;

    for (int i = 1; i <= n + 1; ++ i){

        for (int j = 0; j <= 0; ++ j){

            if (dp[i - 1][j] != -1){

                update(dp[i][0], dp[i - 1][j] + a[i]);

            }

        }

        for (int j = 0; j <= 1; ++ j){

            if (dp[i - 1][j] != -1){

                update(dp[i][1], dp[i - 1][j] + (a[i] == 0 ? 2 : a[i] & 1));

            }

        }

        for (int j = 0; j <= 2; ++ j){

            if (dp[i - 1][j] != -1){

                update(dp[i][2], dp[i - 1][j] + !(a[i] & 1));

            }

        }

        for (int j = 0; j <= 3; ++ j){

            if (dp[i - 1][j] != -1){

                update(dp[i][3], dp[i - 1][j] + (a[i] == 0 ? 2 : a[i] & 1));

            }

        }

        for (int j = 0; j <= 4; ++ j){

            if (dp[i - 1][j] != -1){

                update(dp[i][4], dp[i - 1][j] + a[i]);

            }

        }

    }

    printf("%lld\n", dp[n + 1][4]);

    return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 9.489678744632805x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

typedef long long ll;

const int N=2e5+5;

int n,a[N][3];

ll dp[N][5];

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%d",&a[i][0]);

        a[i][1]=a[i][0]%2==0;

        a[i][2]=a[i][0]==0?2:a[i][0]%2;

    }

    for(int i=1;i<=n;i++)

    {

        ll mn=1e18;

        for(int j=0;j<5;j++)

        {

            mn=min(mn,dp[i-1][j]);

            ll s;

            if(j==0) s=a[i][0];

            else if(j==1) s=a[i][2];

            else if(j==2) s=a[i][1];

            else if(j==3) s=a[i][2];

            else s=a[i][0];

            dp[i][j]=mn+s;

        }

    }

    ll ans=1e18;

    for(int i=0;i<5;i++) ans=min(ans,dp[n][i]);

    printf("%lld\n",ans);

}
// Slower C++ solution:
#include <map>

#include <set>

#include <queue>

#include <stack>

#include <cmath>

#include <cstdio>

#include <string>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;



#define ls st<<1

#define rs st<<1|1

#define LL long long

#define CLR(a,b) memset(a,(b),sizeof(a))



const int MAXN = 1e5+11;

const int mod = 1e9+7;

const int INF = 0x3f3f3f3f;



/* ------------------------基本函数-------------------------*/





LL pow_mod(LL a, LL b) {

	LL ans = 1;

	while(b) {

		if(b&1)

			ans = (ans*a) % mod;

		a = (a*a) % mod;

		b /= 2;

	}

	return ans;

}



int arr[MAXN];

int main() {

	int n;

	cin >> n;

	for(int i = 1; i <= n; i++) {

		cin >>arr[i];

	}

	bool flag = true;

	sort(arr+1,arr+1+n);

	if(n&1) {

		if(arr[1]!=0) flag = false;

		for(int i = 2,j=2; i <= n-1; i+=2,j+=2) {

			//cout<<arr[i]<<' '<<j<< endl;

			if(arr[i] != j) {

				flag = false; break;

			}

		}

	}

	else {

		for(int i = 2,j=1; i<=n; i+=2,j+=2) {

			if(arr[i] != j) {

				flag = false; break;

			}

		}

	}

	if(flag) {

		LL xx = (LL)(n/2);

		//cout << xx<< endl;

		cout << pow_mod(2,xx) << endl;

	}

	else cout << 0 << endl;



return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.6713132918632851x):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

long long powmod(long long y,long long x){

	long long ans=1;

	while(x){

		if(x&1)

			ans=(y*ans)%1000000007;

		x/=2;

		y=(y*y)%1000000007;

		

	}

	return ans;

}

int main(){

	int n;

	while(~scanf("%d",&n)){

		int flag=0; 

		int a[100005];

	

		memset(a,0,sizeof(a));

		for(int i=0;i<n;i++){

			scanf("%d",&a[i]);

		}

		sort(a,a+n);

		if(n%2){

			if(a[0]!=0||a[1]==0){

				flag=1;

			}

		}

		for(int i=1;i<n;i++){

			if(flag==1) break;

			if((n-1-a[i])%2) {

				flag=1;

				break;

			}

			if((a[i]==a[i+1]||a[i]==a[i-1])&&a[i+1]!=a[i-1])

				continue;

			else {

				flag=1;	

				break;

				}

		}

		if(n==1)

			printf("1\n");		

		else if(flag)printf("0\n");

		else printf("%lld\n",powmod((long long)2,(long long)n/2));

		

	}

	return 0;

}
// Slower C++ solution:
#include <map>

#include <set>

#include <queue>

#include <stack>

#include <cmath>

#include <cstdio>

#include <string>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;



#define ls st<<1

#define rs st<<1|1

#define LL long long

#define CLR(a,b) memset(a,(b),sizeof(a))



const int MAXN = 1e5+11;

const int mod = 1e9+7;

const int INF = 0x3f3f3f3f;



/* ------------------------基本函数-------------------------*/





LL pow_mod(LL a, LL b) {

	LL ans = 1;

	while(b) {

		if(b&1)

			ans = (ans*a) % mod;

		a = (a*a) % mod;

		b /= 2;

	}

	return ans;

}



int arr[MAXN];

int main() {

	int n;

	cin >> n;

	for(int i = 1; i <= n; i++) {

		cin >>arr[i];

	}

	bool flag = true;

	sort(arr+1,arr+1+n);

	if(n&1) {

		if(arr[1]!=0) flag = false;

		for(int i = 2,j=2; i <= n-1; i+=2,j+=2) {

			//cout<<arr[i]<<' '<<j<< endl;

			if(arr[i] != j) {

				flag = false; break;

			}

		}

	}

	else {

		for(int i = 2,j=1; i<=n; i+=2,j+=2) {

			if(arr[i] != j) {

				flag = false; break;

			}

		}

	}

	if(flag) {

		LL xx = (LL)(n/2);

		//cout << xx<< endl;

		cout << pow_mod(2,xx) << endl;

	}

	else cout << 0 << endl;



return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.210638102738719x):
#include<cstdio>

#include<algorithm>

#include<cmath>

using namespace std;

int vist[100005];

int Q(int n){

	long long x = 2,ans = 1;

	while(n>0){

		if(n&1)		ans = ans*x%1000000007;

		x = x*x%1000000007;

		n/=2;

	}

	return ans;

}

void Init(int n){

	for(int i = 0; i <= n-1; i++)

		vist[i]	= 0;

}

int main()

{

	int n,m,F;

	while(scanf("%d",&n)!=EOF){

		Init(n);

		F = true;

		for(int i = 0; i < n; i++){

			scanf("%d",&m);

			vist[m]++;		if(m>n-1)	F = false;

		}

		if(n%2!=0){

			for(int i = 0; i <= n-1; i++){

				if(i==0&&vist[i]!=1)		F = false;	

				if(i!=0&&i%2==0&&vist[i]!=2)		F = false;

				if(i%2!=0&&vist[i]!=0)		F = false;	

			}

			if(F){

				int c = Q((n-1)/2);

				printf("%d\n",c%1000000007);

			}

			else	printf("0\n");

		}

		

		else{

			for(int i = 1; i <= n-1; i++){

				if(i%2!=0&&vist[i]!=2)		F = false;

				if(i%2==0&&vist[i]!=0)		F = false;

			}

			if(F){

				int c = Q(n/2);

				printf("%d\n",c%1000000007);

			}

			else	printf("0\n");

		}

	}

	return 0;

}