#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);
ll modpow(ll a, ll n) {
  ll ans = 1;
  while (n > 0) {
    if (n & 1) ans = ans * a % mod;
    n >>= 1;
    a = a * a % mod;
  }
  return ans;
}
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  ll n;
  cin >> n;
  map<pll, pll> slope;
  ll all0 = 0;
  for (ll i = (ll)(0); i < (ll)(n); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      all0++;
      break;
    }
    if (make_pair(a, b) < make_pair(0ll, 0ll)) a = -a, b = -b;
    ll g = gcd(abs(a), abs(b));
    a /= g, b /= g;
    if (b <= 0)
      slope[make_pair(-b, a)].second++;
    else
      slope[make_pair(a, b)].first++;
  }
  ll ans = 1;
  for (auto& i : slope) {
    ll num1 = i.second.first, num2 = i.second.second;
    ans = ans * (modpow(2, num1) + modpow(2, num2) - 1);
  }
  cout << ans + all0 - 1 << endl;
}
