#include #include #include using namespace std; struct point2d { public: int x, y; point2d() : x(0), y(0) {}; point2d(int x_, int y_) : x(x_), y(y_) {}; point2d operator-() const { return point2d(-x, -y); } int quadrant() const { if (y == 0) return x > 0 ? 0 : 4; if (x == 0) return y > 0 ? 2 : 6; if (y > 0) return x > 0 ? 1 : 3; return x > 0 ? 7 : 5; } bool operator==(const point2d& p) const { return x == p.x && y == p.y; } bool operator!=(const point2d& p) const { return x != p.x || y != p.y; } bool operator<(const point2d& p) const { int qa = quadrant(), qb = p.quadrant(); if (qa != qb) return qa < qb; return 1LL * x * p.y > 1LL * y * p.x; } }; int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int main() { int N; cin >> N; vector P(N); vector pli; for (int i = 0; i < N; ++i) { cin >> P[i].x >> P[i].y; int g = gcd(abs(P[i].x), abs(P[i].y)); P[i].x /= g; P[i].y /= g; pli.push_back(P[i]); pli.push_back(-P[i]); } sort(pli.begin(), pli.end()); pli.erase(unique(pli.begin(), pli.end()), pli.end()); int M = pli.size() / 2; vector seq(2 * M); for (int i = 0; i < N; ++i) { int ptr = lower_bound(pli.begin(), pli.end(), P[i]) - pli.begin(); ++seq[ptr]; } int sump = 0, sumq = 0; for (int i = 0; i < M; ++i) { sump += seq[i]; } sumq = sump + seq[M]; long long ans = 0; for (int i = 0; i < 2 * M; ++i) { ans += 1LL * sumq * (sumq - 1) * (sumq - 2) - 1LL * sump * (sump - 1) * (sump - 2); sump += seq[i < M ? i + M : i - M] - seq[i]; sumq += seq[i < M - 1 ? i + M + 1 : i - M + 1] - seq[i]; } for (int i = 0; i < M; ++i) { ans -= seq[i] * seq[i + M] * (seq[i] + seq[i + M] - 2) * 3; } cout << (1LL * N * (N - 1) * (N - 2) - ans) / 6 << endl; return 0; }