#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 998244353;
int INF = 1e9;
int uf[200005];
int parent(int a) {
  if (uf[a] < 0) return a;
  return uf[a] = parent(uf[a]);
}
void join(int a, int b) {
  int pa = parent(a);
  int push_back = parent(b);
  if (pa == push_back) return;
  uf[pa] += uf[push_back];
  uf[push_back] = pa;
}
int gcd(int a, int b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
void solve() {
  map<pair<int, int>, int> memo;
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  map<pair<int, int>, int> solved;
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i] >> b[i];
  for (int(i) = 0; (i) < (n); (i)++) {
    int g = gcd(abs(a[i]), abs(b[i]));
    int aa = a[i] / g;
    int bb = b[i] / g;
    if (aa * bb < 0) {
      aa = -1 * abs(aa);
      bb = abs(bb);
    } else {
      aa = abs(aa);
      bb = abs(bb);
    }
    memo[{aa, bb}]++;
  }
  ll ans = 1LL;
  for (int(i) = 0; (i) < (n); (i)++) {
    int g = gcd(abs(a[i]), abs(b[i]));
    int aa = a[i] / g;
    int bb = b[i] / g;
    if (aa * bb < 0) {
      aa = -1 * abs(aa);
      bb = abs(bb);
    } else {
      aa = abs(aa);
      bb = abs(bb);
    }
    if (solved[{aa, bb}]) continue;
    int count = memo[{aa, bb}];
    int ccount = memo[{-1 * bb, aa}];
    if (aa * bb < 0) {
      ccount = memo[{abs(bb), abs(aa)}];
    } else {
      ccount = memo[{-1 * abs(bb), abs(aa)}];
    }
    if (ccount == 0) {
      ans *= (1 << count);
    } else {
      ans *= ((1 << count) + (1 << ccount) - 1);
    }
    solved[{aa, bb}] = 1;
    if (aa * bb < 0) {
      solved[{abs(bb), abs(aa)}] = 1;
    } else {
      solved[{-1 * abs(bb), abs(aa)}] = 1;
    }
  }
  cout << ans - 1;
}
int main() {
  int T;
  T = 1;
  while (T--) {
    solve();
    cout << endl;
  }
}
