#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b % a == 0) return a;
  return gcd(b % a, a);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int j, i, n, t, l, r, c, h, k, maxi, d, x;
  cin >> n;
  long long int a[n], b[n];
  for (long long j = 0; j < n; j++) {
    cin >> a[j] >> b[j];
  }
  map<pair<long long int, long long int>, long long int> m;
  for (j = 0; j < n; j++) {
    h = gcd(abs(a[j]), abs(b[j]));
    while (h != 1) {
      a[j] = a[j] / h;
      b[j] = b[j] / h;
      h = gcd(abs(a[j]), abs(b[j]));
    }
    m[{a[j], b[j]}]++;
  }
  long long int ans = 0;
  for (long long j = 0; j < n; j++) {
    ans = ans + m[{-b[j], a[j]}] + m[{b[j], -a[j]}];
  }
  cout << (n * (n - 1)) / 2 + n - ans / 2;
}
