#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
using Graph = vector<vector<int> >;
long long pow2(int e, int n) {
  long long res = 1;
  for (int i = 0; i < n; i++) {
    res = (res * e) % mod;
  }
}
int main() {
  int N;
  vector<int> A(N);
  vector<int> B(N);
  vector<double> C(N);
  vector<double> D(N);
  map<double, int> score;
  vector<int> E(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  for (int i = 0; i < N; i++) {
    score[A[i] / B[i]] += 1;
    score[(B[i] / A[i]) * -1.0] += 1;
  }
  for (auto p : score) {
    auto value = p.second;
    E[value] += 1;
  }
  for (int i = 0; i < N; i++) {
    E[i] = E[i] / 2;
  }
  long long ans = 0;
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < E[i]; j++) {
      ans += pow2(2, N - i - j);
    }
  }
  cout << ans << endl;
}
