#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;
 
 
ll ni(ll a){
    if(a==0) return 1;
    else if(a%2==0) return ((ni(a/2)%MOD)*(ni(a/2)%MOD)%MOD);
    else return ((ni(a-1)%MOD)*2%MOD);
}

int main(){
  int n; cin >> n;
  map<P,P> p;
  ll zero=0;

  rep(i,n){
    ll a,b; cin >> a >> b;
    ll g=gcd(a,b);
    a/=g;
    b/=g;
    if(a==0 && b==0){
      zero++;
      continue;
    }
    if(a==0) p[P(0,1)].first++;
    if(b==0) p[P(0,1)].second++;
    if(a>0 && b>0) p[P(a,b)].first++;
    if(a<0 && b<0) p[P(-a,-b)].first++;
    if(a>0 && b<0) p[P(-b,a)].second++;
    if(a<0 && b>0) p[P(b,-a)].second++;
  }

  ll ans=1;

  for(auto m : p){
      ll f=m.second.first;
      ll s=m.second.second;
      ll tmp=1;
      tmp+=ni(f)-1;
      tmp+=ni(s)-1;
      ans*=tmp;
  }

  cout << ans-zero-1 << endl;
return 0;
}
