#include using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(bool b) { return b ? "true" : "false"; } template string to_string(bitset bs) { string res; for (size_t i = 0; i < N; ++i) res += '0' + bs[i]; return res; } string to_string(vector v) { string res = "{"; for (bool e : v) res += to_string(e) + ", "; return res += "}"; } template string to_string(pair p); template string to_string(C c) { string res = "{"; for (auto e : c) res += to_string(e) + ", "; return res += "}"; } template string to_string(pair p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } void debug() { cerr << '\n'; } template void debug(Head head, Tail... tail) { cerr << ' ' << to_string(head), debug(tail...); } #ifdef LOCAL #define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__) #else #define DEBUG(...) #endif constexpr long double pi = acos(-1.0L); constexpr long double eps = 1e-15; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector a; while (n--) { int x, y; cin >> x >> y; if (x == 0 and y == 0) { continue; } a.push_back(atan2((long double)y, x)); } n = a.size(); sort(begin(a), end(a)); for (int i = 0; i < n; ++i) { a.push_back(a[i] + 2 * pi); } DEBUG(a); long long res = (long long)n * (n - 1) * (n - 2) / 6; for (int i = 0; i < n; ++i) { int x = lower_bound(begin(a) + i, end(a), a[i] + pi + eps) - (begin(a) + i); DEBUG(i, x); res -= (x - 1) * (x - 2) / 2; } auto cmp = [](long double l, long double r) { return l + eps < r; }; auto tmod = [](long double x, long double mod) { x = fmod(x, mod); return x < 0 ? x + mod : x; }; map mp(cmp); for (int i = 0; i < n; ++i) { ++mp[a[i]]; } DEBUG(res); for (auto e : mp) { long long x = e.second; DEBUG(e.first, x); long long y = mp.count(e.first + pi) ? mp[e.first + pi] : 0; long long z = x + y; res += z * (z - 1) * (z - 2) / 6; res -= x * (x - 1) * (x - 2) / 6; res -= y * (y - 1) * (y - 2) / 6; } cout << res << '\n'; }