#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("input.txt");ofstream coutt("output.txt");
int poww(int a,int b,int m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}

pii f(pii p){
    int a=p.first;
    int b=p.second;
    if(a*b>=0){
        return {abs(a),abs(b)};
    }else{
        return {-abs(a),abs(b)};
    }
}

pii fi(pii p){
    int a=p.first;
    int b=p.second;
    if(a*b>=0){
        return {-abs(b),abs(a)};
    }else{
        return {abs(b),abs(a)};
    }
}

signed main(){
    FASTER;
    int n;cin>>n;
    vii v(n);cin>>v;
    
    int cnt=0;
    map<pii,int> mp;
    for(pii &p:v){
        if(p.first==0 && p.second==0){
            cnt++;
            continue;
        }
        int g=__gcd(abs(p.first),abs(p.second));
        p.first/=g;
        p.second/=g;
        mp[f(p)]++;
    }
    
    map<pii,bool> vis;
    int ans=1;
    for(pii p:v){
        pii x=f(p);
        pii y=fi(x);
        if(vis[x]||vis[y]||(p.first==0 && p.second==0))continue;
        
        int le=(poww(2,mp[x])+poww(2,mp[y])-1+MOD)%MOD;
        (ans*=le)%=MOD;
        
        vis[x]=vis[y]=1;
    }
    (ans+=cnt-1+MOD)%=MOD;
    cout<<ans;
}
