#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n;
  cin>>n;
  ull exr = 0;
  map<pair<ll, ll>, pair<ll, ll>> sar;
  rep(i, n) {
    ll a,b;
    cin>>a>>b;
    if (a == 0 && b == 0) {
        exr++;
        continue;
    }
    ll g = gcd(a,b);
    a /= g;
    b /= g;
    
    if (b < 0) a = -a, b = -b;
    if (b == 0 && a < 0) a = -a, b = -b; 
    if (a <= 0) {
    ll t = -a;
    a = b;
    b = t;
    sar[{a,b}].first++;
    } else {
    sar[{a,b}].second++;
    }
  }
  ull ans = 1;
  for(auto x : sar) {
    ull base = 2;
    ull a = x.second.first;
    ull b = x.second.second;
    ull pa = pow(base, a) - 1;
    ull pb = pow(base, b) - 1;
    ull cur = pa + pb;
    cur++;
    ans *= cur;
  }
  ans -= 1;
  ans += exr;
  cout << ans;
}
