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

ll powll(ll x,ll t)
{
    if(!t) return 1;
    ll a = powll(x,t>>1);
    a*=a;
    if(t&1) a*= x;
    return a;
}

int main(){
    int n;
    int zero = 0;
    map<pair<ll,ll>,P> mp;
    cin >> n;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        if(x == 0 && y == 0) {
            zero++;
            continue;
        }
        ll g= gcd(x,y);
        x /= g;
        y /= g;
        if(y < 0) x = -x, y = -y;
        bool rot90 = (x<=0);
        if(rot90){
            ll temp = x;
            x = y;y = -temp;
        }
        if(rot90) mp[{x,y}].first++;
        else mp[{x,y}].second++;
    }
    ll ans = 1;
    for(auto p:mp){
        int s = p.second.first;
        int t = p.second.second;
        ll now = 1;
        now += powll((ll)2,s) -1;
        now += powll((ll)2,t) -1;
        //now %= (ll)1000000007;
        ans *= now;
        //ans %= (ll)1000000007;
        //if(ans == 0) ans = (ll)1000000007;
    }
    //ans += ((ll)zero + (ll)1000000007);
    //ans %= (ll)1000000007;
    cout << ans << endl;
    return 0;
}