Problem:
Score : 300 points

Problem Statement

There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).

We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:

Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.

Find the minimum total cost required to collect all the balls when we optimally choose p and q.

Constraints

1 \leq N \leq 50

|x_i|, |y_i| \leq 10^9

If i \neq j, x_i \neq x_j or y_i \neq y_j.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print the minimum total cost required to collect all the balls.

Sample Input 1

2
1 1
2 2

Sample Output 1

1

If we choose p = 1, q = 1, we can collect all the balls at a cost of 1 by collecting them in the order (1, 1), (2, 2).

Sample Input 2

3
1 4
4 6
7 8

Sample Output 2

1

If we choose p = -3, q = -2, we can collect all the balls at a cost of 1 by collecting them in the order (7, 8), (4, 6), (1, 4).

Sample Input 3

4
1 1
1 2
2 1
2 2

Sample Output 3

2

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/*#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// ---------------------------  TEMPLATE ENDS  -------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9+7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 1e5 + 2;

vvi adj;
string to_string(string s) {
	return '"' + s + '"';
}
string to_string(const char* s) {
	return to_string((string) s);
}
string to_string(bool b) {
	return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
	bool first = true;  string res = "{";
	for (const auto &x : v) {
		if (!first) { res += ", "; }
		first = false; res += to_string(x);
	}
	res += "}";	  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

// /#define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
bool chck(int x1, int y1, int x2, int y2, int p, int q) {
	int x = x2-x1, y = y2 - y1;
	if(p == 0) {
		return x == 0 and y%q == 0;
	}
	if(q == 0) {
		return y == 0 and x%p == 0;
	}
	if(x%p == 0 and y%q == 0 and x/p == y/q) return 1;
	return 0;
}


void solve(){
	int i = 0, j = 0, k = 0, n = 0, m = 0;
	cin>>n;
	vpi a(n);
	fr(i, 0, n) {
		cin>>a[i].fi>>a[i].se;
	}
	if(n == 1) {
		cout << "1\n";
	}
	else {
		int ans = 0;
		fr(i, 0, n-1) {
			fr(j, i+1, n) {
				int p = a[j].fi - a[i].fi;
				int q = a[j].se - a[i].se;
				set<int> s;
				fr(i, 0, n) {
					s.insert(i);
				}
				while(s.size() > 1) {
					vector<set<int>::iterator> del;
					auto ptr = s.begin();
					auto it = s.begin();
					it++;
					for(; it != s.end(); it++) {
						cnt += chck()
					}
				}
				int cnt = 0;
				fr(k, 0, n) {
					if(i == k) continue;
					cnt += chck(a[i].fi, a[i].se, a[k].fi, a[k].se, p, q);
				}
				remax(ans, cnt);
			}
		}

		cout << (n - ans) << endl;
	}
}

	int32_t main(){
#ifndef TRACE
		ios::sync_with_stdio(false); cin.tie(0); 
#endif
		int T = 1, tc;
      // cin >> T;
		for(tc = 1; tc <= T; tc++){
			solve();
		}
		return 0;
	}*/

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// ---------------------------  TEMPLATE ENDS  -------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9+7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 1e5 + 2;

vvi adj;
string to_string(string s) {
	return '"' + s + '"';
}
string to_string(const char* s) {
	return to_string((string) s);
}
string to_string(bool b) {
	return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
	bool first = true;  string res = "{";
	for (const auto &x : v) {
		if (!first) { res += ", "; }
		first = false; res += to_string(x);
	}
	res += "}";	  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

// #define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
bool chck(int x1, int y1, int x2, int y2, int p, int q) {
	int x = x2-x1, y = y2 - y1;
	if(p == 0) {
		return x ==0 and y%q == 0;
	}
	if(q == 0) {
		return y == 0 and x%p == 0;
	}
	if(x%p == 0 and y%q == 0 and x/p == y/q) return 1;
	return 0;
}


void solve(){
	int i = 0, j = 0, k = 0, n = 0, m = 0;
	cin>>n;
	vpi a(n);
	fr(i, 0, n) {
		cin>>a[i].fi>>a[i].se;
	}
	if(n == 1) {
		cout << "1\n";
	}
	else {
		int ans = 0;
		fr(i, 0, n-1) {
			fr(j, i+1, n) {
				int p = a[j].fi - a[i].fi;
				int q = a[j].se - a[i].se;
				// if(p == 0 and q == 0) continue;
				int cnt = 0;
				vb vis(n, 0);
				debug(i, j, p, q);
				for(int ii =0 ;ii < n-1; ii++) {
					if(vis[ii]) continue;
					for(int jj = ii+1; jj < n; jj++) {
						if(vis[jj]) continue;
						int h = chck(a[ii].fi, a[ii].se, a[jj].fi, a[jj].se, p, q);
						if(h) {
							cnt++;
							debug(ii, jj, cnt);
							vis[jj] = 1;
						}
					}
					
				}
				debug(cnt);
				remax(ans, cnt);
			}
		}

		cout << (n - ans) << endl;
	}
}

	int32_t main(){
#ifndef TRACE
		ios::sync_with_stdio(false); cin.tie(0); 
#endif
		int T = 1, tc;
      // cin >> T;
		for(tc = 1; tc <= T; tc++){
			solve();
		}
		return 0;
	}