#include #include #include #include #include using namespace std; const int MAX_N = 1000; const int MAX_COORD = 20000; typedef pair pii; int gcd(int a, int b) { if (a < 0) return gcd(-a, b); if (b < 0) return gcd(a, -b); if (!b) return a; return gcd(b, a%b); } struct Line { int a, b, c; void normalize() { if (a < 0 || (a == 0 && b < 0)) { a *= -1; b *= -1; c *= -1; } int g = gcd(gcd(a, b), c); a /= g; b /= g; c /= g; } Line(pii p1, pii p2) // perpendicular bisector between p1 and p2 { pii mid{(p1.first + p2.first)/2, (p1.second + p2.second)/2}; a = p2.first - p1.first; b = p2.second - p1.second; c = -(a * mid.first + b * mid.second); normalize(); } Line(pii p1, pii p2, int dummy) // line connecting p1 and p2 { a = p1.second - p2.second; b = p2.first - p1.first; c = -(a * p1.first + b * p1.second); normalize(); } bool on_line(pii p) const { long long res = (long long) a * p.first; res += (long long) b * p.second; res += c; return res == 0; } bool operator==(const Line &L) const { return a == L.a && b == L.b && c == L.c; } bool operator<(const Line &L) const { if (a != L.a) return a < L.a; if (b != L.b) return b < L.b; return c < L.c; } }; int main() { int N; cin >> N; assert(1 <= N && N <= MAX_N); pii p[MAX_N]; for (int i = 0; i < N; i++) { cin >> p[i].first >> p[i].second; assert(-MAX_COORD <= min(p[i].first, p[i].second) && max(p[i].first, p[i].second) <= MAX_COORD); p[i].first *= 2; p[i].second *= 2; } // let's look at candidates for centers map centers; for (int i = 0; i < N; i++) { // a point can always be its own center centers[p[i]]++; for (int j = i+1; j < N; j++) { pii C{(p[i].first + p[j].first)/2, (p[i].second + p[j].second)/2}; centers[C] += 2; } } int ans = INT_MAX; for (auto c : centers) { ans = min(ans, N - c.second); } map lines; for (int i = 0; i < N; i++) { for (int j = i+1; j < N; j++) { Line L{p[i], p[j]}; lines[L] += 2; Line L2{p[i], p[j], 1}; lines[L2] += 0; } } for (auto L : lines) { int temp = N - L.second; for (int i = 0; i < N; i++) { if (L.first.on_line(p[i])) temp--; } ans = min(ans, temp); } cout << ans << endl; return 0; }