/*author - Aryan Mittal*/
#include<bits/stdc++.h>
using namespace std;

#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")


#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"

#define ll long long
#define pie_value 3.14159265358979323846
#define mod (ll)1000000007

ll power(ll a, ll b) {
	if (b == 0)
		return 1;

	ll val = power(a, b / 2) % mod;
	if (b % 2 == 0) {
		return (val * val) % mod;
	} else {
		return (a % mod * (val * val) % mod) % mod;
	}
}

int main() {

	// Use ctrl+shift+b ( second option )
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt" , "w" , stderr);
#endif

	ll n;
	cin >> n;

	ll mp_oe = 0, mp_ee = 0, mp_oo = 0;
	ll no = n;

	while (n--) {
		ll l, r;
		cin >> l >> r;

		if (l % 2 == 0 && r % 2 == 0) {
			mp_ee++;
		} else if (l % 2 != 0 && r % 2 != 0) {
			mp_oo++;
		} else {
			mp_oe++;
		}
	}

	n = no;


	if (mp_oe == 0 && mp_oo % 2 == 0) {
		cout << 0 << "\n";
	} else if (mp_oe == 0 && mp_oo % 2 != 0) {
		cout << power(2, n) % mod << "\n";
	} else {
		//watch(n);
		cout << power(2, n - 1) % mod << "\n";
	}



	return 0;
}
