#include <bits/stdc++.h>
const int MAX = 510000;
using namespace std;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % (1000000007);
    inv[i] = (1000000007) -
             inv[(1000000007) % i] * ((1000000007) / i) % (1000000007);
    finv[i] = finv[i - 1] * inv[i] % (1000000007);
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % (1000000007)) % (1000000007);
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long N;
  cin >> N;
  COMinit();
  map<pair<long long, long long>, long long> m;
  vector<double> rad(N);
  for (long long i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (m.find(make_pair(A / gcd(A, B), B / gcd(A, B))) == m.end())
      m[make_pair(A / gcd(A, B), B / gcd(A, B))] = 1;
    else
      m[make_pair(A / gcd(A, B), B / gcd(A, B))]++;
  }
  vector<long long> v;
  for (auto itr = m.begin(); itr != m.end(); ++itr) {
    pair<long long, long long> key = itr->first;
    long long one = 0;
    long long two = 0;
    if (m.find(make_pair(key.second, -key.first)) != m.end())
      one = m[make_pair(key.second, -key.first)];
    if (m.find(make_pair(-key.second, key.first)) != m.end())
      two = m[make_pair(-key.second, key.first)];
    v.push_back(N - one - two);
  }
  double ret = 0;
  for (long long i = 0; i < v.size(); i++) {
    for (long long j = 1; j <= v[i]; j++) {
      ret += (double)(COM(v[i], j) / COM(v.size(), j));
    }
  }
  cout << (long long)ret << endl;
  return 0;
}
