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