/* -*- coding: utf-8 -*- * * 2355.cc: No.2355 Unhappy Back Dance - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 1500; /* typedef */ typedef long long ll; template struct Pt { T x, y; Pt() {} Pt(T _x, T _y) : x(_x), y(_y) {} Pt(const Pt &p) : x(p.x), y(p.y) {} Pt operator+(const Pt p) const { return Pt(x + p.x, y + p.y); } Pt operator-() const { return Pt(-x, -y); } Pt operator-(const Pt p) const { return Pt(x - p.x, y - p.y); } Pt operator*(T t) const { return Pt(x * t, y * t); } Pt operator/(T t) const { return Pt(x / t, y / t); } T dot(Pt v) const { return x * v.x + y * v.y; } T cross(Pt v) const { return x * v.y - y * v.x; } Pt mid(const Pt p) { return Pt((x + p.x) / 2, (y + p.y) / 2); } T d2() { return x * x + y * y; } bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; } bool operator<(const Pt &pt) const { return x < pt.x || (x == pt.x && y < pt.y); } T gcd(T m, T n) { // m >= 0, n >= 0 if (m < n) swap(m, n); while (n > 0) { T r = m % n; m = n; n = r; } return m; } Pt &normalize() { if (x == 0) y = (y > 0) ? 1 : (y < 0) ? -1 : 0; else if (y == 0) x = (x > 0) ? 1 : (x < 0) ? -1 : 0; else { T g = gcd(abs(x), abs(y)); if (g > 1) x /= g, y /= g; } return *this; } void print() { printf("%lld,%lld ", x, y); } }; typedef Pt pt; /* global variables */ pt ps[MAX_N], vs[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lld%lld", &ps[i].x, &ps[i].y); int cnt = 0; for (int i = 0; i < n; i++) { int k = 0; for (int j = 0; j < n; j++) if (i != j) { pt v(ps[j] - ps[i]); v.normalize(); vs[k++] = v; } sort(vs, vs + k); //ps[i].print(); for (int j = 0; j < k; j++) vs[j].print(); putchar('\n'); for (int j = 0; j + 1 < k; j++) if (vs[j] == vs[j + 1]) { cnt++; break; } } printf("%d\n", cnt); return 0; }