jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,x[maxn],y[maxn],ans,dl;
PII d[maxn];
int main(){
	n=read();
	FOR(i,1,n) x[i]=read(),y[i]=read();
	FOR(i,1,n) FOR(j,1,n){
		if(i==j) continue;
		d[++dl]=MP(x[i]-x[j],y[i]-y[j]);
	}
	sort(d+1,d+dl+1);
	FOR(i,1,dl){
		int cnt=0,j=i;
		while(j<=dl && d[i]==d[j]) j++,cnt++;
		ans=max(ans,cnt);
		i=j-1;
	}
	printf("%d\n",n-ans);
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  vector<ii> a(n);
  for (auto &i : a) cin >> i.fi >> i.sc;
  map<ii, int> mem;
  for (int i = 0; i < n - 1; i++)
  for (int j = i + 1; j < n; j++) {
    mem[ii(a[j].fi - a[i].fi, a[j].sc - a[i].sc)]++;
  }
  int ans = 0;
  for (auto &i : mem) {
    ans = max(ans, i.sc);
  }
  cout << n - ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}
//  [cpp]
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
using namespace std;
using lint = long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };

const lint INF = 1ll << 60;
const int mod = 1000000007;
const int inf = INT_MAX;
void speed() {
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	return;
}



int main(void) {
	speed();
	int n; cin >> n;
	vector<pair<int, int>> d(n);
	map<pair<lint, lint>, lint> m;
	for (int i = 0; i < n; i++) {
		cin >> d[i].first >> d[i].second;
	}
	for (int i = 0; i < n; i++)
		for (int j = 0; j < i; j++)
			m[make_pair(d[i].first - d[j].first, d[i].second - d[j].second)]++;
	lint ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			ans = max(ans, m[make_pair(d[i].first - d[j].first, d[i].second - d[j].second)]);
		}
	}
	cout << n - ans << endl;

	return 0;
}
//  [cpp]
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
using namespace std;
using lint = long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };

const lint INF = 1ll << 60;
const int mod = 1000000007;
const int inf = INT_MAX;
void speed() {
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	return;
}



int main(void) {
	speed();
	int n; cin >> n;
	vector<pair<int, int>> d(n);
	map<pair<lint, lint>, lint> m;
	for (int i = 0; i < n; i++) {
		cin >> d[i].first >> d[i].second;
	}
	for (int i = 0; i < n; i++)
		for (int j = 0; j < i; j++)
			m[make_pair(d[i].first - d[j].first, d[i].second - d[j].second)]++;
	lint ans = 0;
	for (auto p : m) {
		ans = max(ans, m[make_pair(p.first.first, p.first.second)]);
	}
	cout << n - ans  << endl;

	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

// 小大
int cmp1( const void *p, const void *q ) {
    if( ((frequent*)p)->aa == ((frequent*)q)->aa  ) return ((frequent*)p)->bb - ((frequent*)q)->bb;
    return ((frequent*)p)->aa - ((frequent*)q)->aa;
}

int main(void){
    // char ;
    ll n,ans=1;
    scanf("%lld",&n);
    if(n==1){
        printf("1\n");
        return 0;
    }
    ll x[n],y[n];
    rep(i,0,n){
        scanf("%lld%lld",&x[i],&y[i]);
    }
    ll r=0;
    frequent d[n*(n-1)];
    rep(i,0,n){
        rep(j,0,n){
            if(i==j) continue;
            d[r].aa=x[i]-x[j];
            d[r].bb=y[i]-y[j];
            r++;
        }
    }
    qsort(d,r,sizeof(frequent),cmp1);
    ll fff=1,ma=1;
    rep(i,1,r){
        if( d[i].aa==d[i-1].aa  && d[i].bb==d[i-1].bb ){
            fff++;
        }else{
            ma=max2(ma,fff);
            fff=1;
        }
        // printf("%lld f ",fff);
    }
    // rep(i,0,r){
    //     printf("%lld %lld\n",d[i].aa,d[i].bb);
    // }
    ans=n-ma;
    printf("%lld\n",ans);
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>

typedef struct {
	long long x;
	long long y;
}posi_t;

typedef struct {
	long long p;
	long long q;
}pair_t;

int cmp(const void* a, const void* b) {
	if (((pair_t*)a)->p - ((pair_t*)b)->p != 0)
		return ((pair_t*)a)->p - ((pair_t*)b)->p;
	else
		return ((pair_t*)a)->q - ((pair_t*)b)->q;
}

int main(void) {
	long long n;
	posi_t posi[50] = { 0 };
	pair_t pair[2500] = { 0 };
	int cnt = 0, max = 1;
	int temp = 1;

	scanf("%lld", &n);
	for (int i = 0; i < n; i++) 
		scanf("%lld %lld", &posi[i].x,&posi[i].y);

	if (n <= 2)printf("1");
	else {
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				pair[cnt].p = posi[i].x - posi[j].x;
				pair[cnt].q = posi[i].y - posi[j].y;
				if (pair[cnt].p < 0)
					pair[cnt].p *= -1, pair[cnt].q *= -1;
				else if (pair[cnt].p == 0 && pair[cnt].q < 0)
					pair[cnt].q *= -1;
				cnt++;
			}
		}
		qsort(pair, cnt, sizeof(pair_t), cmp);
		for (int i = 0; i <= cnt; i++) {
			if ((pair[i].p != 0 || pair[i].q != 0)&&pair[i].p == pair[i + 1].p &&
					pair[i].q == pair[i + 1].q)
					temp++;
			else {
				if (max < temp) {
					max = temp;
				}
					temp = 1;
				
			}
		}
		printf("%lld", n - max);
	}
	return 0;
}
//  [c]
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compl(const void *a, const void *b){return (*(long*)a<*(long*)b)-(*(long*)a>*(long*)b);}

int main(void){
	int n, i, j;
	int x[50], y[50];
	scanf("%d", &n);
	if(n==1){
		puts("1");
		return EXIT_SUCCESS;
	}
	for(i=0; i<n; i++){
		scanf("%d%d", x+i, y+i);
	}
	int s[2500][2], S=0;
	for(i=0; i<n; i++){
		for(j=0; j<i; j++){
			int dx=x[i]-x[j];
			int dy=y[i]-y[j];
			if(dy<0){dx=-dx; dy=-dy;}
			if(dy==0 && dx<0){dx=-dx;}
			s[S][0]=dx;
			s[S][1]=dy;
			S++;
		}
	}
	qsort(s, S, sizeof(int)*2, compl);
	int max=0, now=1;
	for(i=1; i<S; i++){
		if(s[i][0]==s[i-1][0] && s[i][1]==s[i-1][1]){
			now++;
		}else{
			if(now>max) max=now;
			now=1;
		}
	}
	if(now>max) max=now;
	printf("%d\n", n-max);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
typedef struct{int first, second, pi, pj;} P;
int upcmpllp(const void *a, const void *b){
    if(((P*)a)->first != ((P*)b)->first) 
        return (((P*)a)->first > ((P*)b)->first?1:-1);
    else
        return (((P*)a)->second == ((P*)b)->second ? 0 : (((P*)a)->second > ((P*)b)->second ? 1 : -1));
}
void sort_up(P *a, int n){ qsort(a, n, sizeof(P), upcmpllp); }

int main(){
    int n;
    scanf("%d", &n);
    int x[55], y[55];
    P diff[2525];
    rep(i, n) scanf("%d%d", &x[i], &y[i]);

    int ans = 55;
    int idx = 0;
    for(int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            diff[idx].first = x[j] - x[i];
            diff[idx].second = y[j] - y[i];
            diff[idx].pi = i;
            diff[idx].pj = j;
            idx++;
        }
    }
    sort_up(diff, idx);
    int ch[55];
    rep(i, n) ch[i] = 1;
    rep(i, idx){
        ch[diff[i].pj] = 0;
        if(i+1 < idx 
           && diff[i].first == diff[i+1].first
           && diff[i].second == diff[i+1].second){
        }else{
            int tmp = 0;
            rep(j, n) tmp += ch[j];
            ans = min(ans, tmp);
            rep(j, n) ch[j] = 1;
        }
    }
    if(n == 1) ans = 1;
    printf("%d\n", ans);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
typedef struct{int first, second, i, j;} P;
int upcmpllp(const void *a, const void *b){
    if(((P*)a)->first != ((P*)b)->first) 
        return (((P*)a)->first > ((P*)b)->first?1:-1);
    else
        return (((P*)a)->second == ((P*)b)->second ? 0 : (((P*)a)->second > ((P*)b)->second ? 1 : -1));
}
void sort_up(P *a, int n){ qsort(a, n, sizeof(P), upcmpllp); }

int main(){
    int n;
    scanf("%d", &n);
    int x[55], y[55];
    P diff[2525];
    rep(i, n) scanf("%d%d", &x[i], &y[i]);

    int ans = 55;
    int idx = 0;
    for(int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            diff[idx].first = x[i] - x[j];
            diff[idx].second = y[i] - y[j];
            diff[idx].i = i;
            diff[idx].j = j;
            idx++;
        }
    }
    sort_up(diff, idx);
    int ch[55];
    rep(i, n) ch[i] = 1;
    rep(i, idx){
        ch[diff[i].j] = 0;
        if(i+1 < idx 
           && diff[i].first == diff[i+1].first
           && diff[i].second == diff[i+1].second){
        }else{
            int tmp = 0;
            rep(j, n) tmp += ch[j];
            ans = min(ans, tmp);
            rep(j, n) ch[j] = 1;
        }
    }
    if(n == 1) ans = 1;
    printf("%d\n", ans);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
typedef struct{int first, second, i, j;} P;
int upcmpllp(const void *a, const void *b){
    if(((P*)a)->first != ((P*)b)->first) 
        return (((P*)a)->first > ((P*)b)->first?1:-1);
    else
        return (((P*)a)->second == ((P*)b)->second ? 0 : (((P*)a)->second > ((P*)b)->second ? 1 : -1));
}
void sort_up(P *a, int n){ qsort(a, n, sizeof(P), upcmpllp); }

int main(){
    int n;
    scanf("%d", &n);
    int x[55], y[55];
    P diff[2525];
    rep(i, n) scanf("%d%d", &x[i], &y[i]);

    int ans = 55;
    int idx = 0;
    for(int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            diff[idx].first = x[i] - x[j];
            diff[idx].second = y[i] - y[j];
            diff[idx].i = i;
            diff[idx].j = j;
            idx++;
        }
    }
    sort_up(diff, idx);
    int ch[55];
    rep(i, n) ch[i] = 1;
    rep(i, idx){
        ch[diff[i].j] = 0;
        if(i+1 < idx 
           && diff[i].first == diff[i+1].first
           && diff[i].second == diff[i+1].second){
        }else{
            int tmp = 0;
            rep(i, n) tmp += ch[i];
            ans = min(ans, tmp);
            rep(i, n) ch[i] = 1;
        }
    }
    if(n == 1) ans = 1;
    printf("%d", ans);
}
//  [javascript]
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,e,t){"use strict";function n(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var e=Number(r[0]),t=[],o=[],u=0;u<e;u++){var i=n(r[u+1].split(" ").map(function(r){return Number(r)}),2),f=i[0],a=i[1];t.push(f),o.push(a)}for(var l=new Map,c=0;c<e;c++)for(var p=0;p<e;p++)if(c!=p){var s=`${t[c]-t[p]}:${o[c]-o[p]}`;l[s]||(l[s]=0),l[s]++}var d=0;for(var v in l)l[v]>d&&(d=l[v]);var y=e-d;console.log(y)}},function(r,e){r.exports=require("fs")}]);
//  [javascript]
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n").filter(Boolean);
    const n = +input[0];
  
    if (n <= 2) {
      console.log(1);
      return;
    }
  
    const xy = input.slice(1).map(s => s.split(' ').map(n => +n));
  
    const map = {};
    xy.forEach(a => {
      xy.forEach(b => {
        if (a === b) return; // 自分自身の場合
        
        const vec = [b[0] - a[0], b[1] - a[1]];
        const m = vec.join('_');
        map[m] = map[m] == null ? 1 : map[m] + 1;
      });
    });

	const res = Object.keys(map).reduce((r, xystr) => {
		const count = map[xystr];
        return count > r[0] ? [count, xystr] : [r[0], r[1]];
    }, [1, '']);
  	
//    const pq = res[1];
    
    console.log(n - res[0]);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
log = console.log;
var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin.split("\n");
var N = lines[0].split(" ").map(Number)[0];
var Points = lines
  .slice(1)
  .filter(v => v !== "")
  .map(v => v.split(" ").map(Number));

var diffList = [];

Points.forEach((pointA, i) => {
  var Ax = pointA[0];
  var Ay = pointA[1];
  diffList[i] = [];
  Points.forEach(pointB => {
    var Bx = pointB[0];
    var By = pointB[1];
    if (Bx === Ax && By === Ay) return;
    diffList[i].push([Bx - Ax, By - Ay]);
  });
});

var dList = [];
var countList = {};
diffList.forEach(diff => {
  diff.forEach(d => {
    countList[d.toString()] = countList[d.toString()]
      ? countList[d.toString()] + 1
      : 1;
  });
});

var max = 0
Object.keys(countList).forEach(key=>{
  if(countList[key] > max) max = countList[key]
})
log(N - max)
//  [javascript]
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,e,t){"use strict";function n(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var e=Number(r[0]),t=[],o=[],u=0;u<e;u++){var i=n(r[u+1].split(" ").map(function(r){return Number(r)}),2),f=i[0],a=i[1];t.push(f),o.push(a)}for(var l=new Map,c=1;c<e;c++){var p=`${t[c]-t[c-1]}:${o[c]-o[c-1]}`;l[p]||(l[p]=0),l[p]++}var s=0;for(var d in l)l[d]>s&&(s=l[d]);var v=e-s;console.log(v)}},function(r,e){r.exports=require("fs")}]);
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()

	x := make([]int, n)
	y := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = scanInt()
		y[i] = scanInt()
	}

	cnt := make(map[point]int)
	ma := 0

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}

			p := x[i] - x[j]
			q := y[i] - y[j]
			cnt[point{p,q}]++
			ma = max(ma, cnt[point{p,q}])
		}
	}

	fmt.Fprintln(wr, n-ma)
	// fmt.Fprintln(wr, cnt)

}

type point struct {
	x,y int
}
//  [go]
package main

import "fmt"

type point struct {
	x, y int
}

func main() {
	var n int
	fmt.Scan(&n)
	points := make([]point, n)
	for i := range points {
		fmt.Scan(&points[i].x, &points[i].y)
	}
	// 1 <= N <= 50なので、全部の2点間のベクトルを計算できる
	if n <= 1 {
		fmt.Println(1) // 点が2個以下ならコスト1
		return
	}
	vectors := make(map[point]int, 0)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			var v point
			v.x = points[i].x - points[j].x
			v.y = points[i].y - points[j].y
			vectors[v]++
		}
	}
	// fmt.Println("points", points)
	// fmt.Println("vectors", vectors)
	maxv := 0
	for _, v := range vectors {
		maxv = max(maxv, v)
	}
	fmt.Println(n - maxv)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ps := make([]Pair, n)
	var x, y int
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &y)
		ps[i] = Pair{x, y}
	}

	mx := 0
	for i := 1; i < n; i++ {
		p := ps[0].x - ps[i].x
		q := ps[0].y - ps[i].y
		cnt := 0
		for j := 0; j < n; j++ {
			a := ps[j]
			for k := 0; k < n; k++ {
				b := ps[k]
				if j == k {
					continue
				}
				if a.x-b.x == p && a.y-b.y == q {
					cnt++
				}
			}
		}
		if mx < cnt {
			mx = cnt
		}
	}

	fmt.Println(n - mx)
}

// Pair .
type Pair struct {
	x, y int
}
//  [ruby]
n = gets.to_i
xys = []
xys << [0, 0]
n.times do
  xys << gets.split.map(&:to_i)
end
xys.sort_by! { |x| x }

h = Hash.new(0)
(0..n-1).each do |i|
  x1, y1 = xys[i]
  ((i+1)..n).each do |j|
    x2, y2 = xys[j]
    h["#{x2-x1} #{y2-y1}"] += 1
  end
end
h[xys[1].join(" ")] -= 1

ans = n - h.max_by { |k,v| v }[1]
if h.size == 1
  ans += 1
end
if n == 1
  puts 1
else
  puts ans
end
//  [ruby]
n = gets.to_i
a = []
n.times do |i|
  x,y = gets.split.map &:to_i
  a << [x,y]
end

dist = []
(0..n-1).to_a.combination(2) do |i,j|
  x = a[i][0]-a[j][0]
  y = a[i][1]-a[j][1]
  if y < 0 || (y == 0 && x < 0)
    y = -y
    x = -x
  end
  dist << [x,y]
end

cnt = dist.group_by(&:itself)
  .values
  .map(&:size)
  .max

cnt ||= 0
puts n - cnt
//  [ruby]
n = gets.chomp.to_i
xy = []
x = []
y = []

if n == 1
    puts "1"
else

    for i in 1..n do
        input = gets.chomp.split(" ").map(&:to_i)
        xy.push(input) 
    end

    xy.sort! {|a,b| (a[0] <=> b[0]).nonzero? || (a[1] <=> b[1])}
    dif = []
    count_max = 1
    for i in 1..n-1 do
        for j in i+1..n do
            x0 = xy[j-1][0] - xy[i-1][0]
            y0 = xy[j-1][1] - xy[i-1][1]
            dif.push([x0,y0])
        end
    end
    dif.sort! {|a,b| (a[0] <=> b[0]).nonzero? || (a[1] <=> b[1])}
    


    count = 1
    tar = dif[0]
    size = dif.length
    for i in 1..(size -1)
        if dif[i] == tar
            count += 1
        else
            if count_max < count 
                count_max = count                
            end
            count = 1
            tar = dif[i]
        end
    end
    p n - count_max
end
//  [ruby]
N=gets.to_i
if N == 1
    puts 0
    exit
end
xys=[]
diffs={}
N.times do
    x,y=gets.chomp.split(" ").map(&:to_i)
    xys.each do |w,t|
        if x>w || x==w && y>t
            diffs["#{x-w}_#{y-t}"] ||= 0
            diffs["#{x-w}_#{y-t}"] += 1
        else
            diffs["#{w-x}_#{t-y}"] ||= 0
            diffs["#{w-x}_#{t-y}"] += 1
        end
    end
    xys.push([x,y])
end
n=diffs.values.sort[-1]
puts N-n
//  [ruby]
N=gets.to_i
xys=[]
diffs={}
N.times do
    x,y=gets.chomp.split(" ").map(&:to_i)
    xys.each do |w,t|
        if x>w || x==w && y>t
            diffs["#{x-w}_#{y-t}"] ||= 0
            diffs["#{x-w}_#{y-t}"] += 1
        else
            diffs["#{w-x}_#{t-y}"] ||= 0
            diffs["#{w-x}_#{t-y}"] += 1
        end
    end
    xys.push([x,y])
end
n=diffs.values.sort[-1]
puts N-n
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
x = []
y = []
n.times do
  xx, yy = gets.chomp.split.map(&:to_i)
  x.push xx
  y.push yy
end

if n == 1
  puts 0
  exit
end


h = Hash.new(0)
n.times do |i|
  n.times do |j|
    next if i == j
    len = [x[i] - x[j], y[i] - y[j]]
    h[len] += 1
  end
end

puts n - h.values.max
//  [rust]
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let n: usize = read();
    let xyv: Vec<Vec<i64>> = read_vec2(n);
    if n == 1 {
        println!("1");
        return;
    }
    let mut v: Vec<(i64, i64)> = vec![];
    for i in 0..n {
        for j in i + 1..n {
            let x = xyv[i][0] - xyv[j][0];
            let y = xyv[i][1] - xyv[j][1];
            if x > 0 || (x == 0 && y > 0) {
                v.push((x, y));
            } else {
                v.push((-x, -y));
            }
        }
    }
    v.sort_by(|p, q| {
        if p.0 != q.0 {
            p.0.partial_cmp(&q.0).unwrap()
        } else {
            p.1.partial_cmp(&q.1).unwrap()
        }
    });
    let mut max: usize = 1;
    let mut cnt: usize = 1;
    for i in 1..v.len() {
        if v[i] == v[i - 1] {
            cnt += 1;
        } else {
            if cnt > max {
                max = cnt;
            }
            cnt = 1;
        }
    }
    if cnt > max {
        max = cnt;
    }
    println!("{}", n - max);
}
//  [rust]
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, xy: [(i64, i64); n]);

    let mut mp = BTreeMap::new();

    // 座標同士の差分の組みがどれだけあるかを調べる
    // 最も多い差分の組みをp, qとして見なすのが最適
    // (ここらへんの証明を正しく言語化できてないから、「有効辺の個数の最大化」「連結成分」などについて要学習)
    // コストはN - その組みの個数
    for i in 0..n {
        let (x1, y1) = xy[i];
        for j in 0..n {
            if i == j {
                continue;
            }
            let (x2, y2) = xy[j];
            *mp.entry((x2 - x1, y2 - y1)).or_insert(0) += 1;
        }
    }

    let mut nax = 0;
    for (_, c) in mp.iter() {
        nax = max(nax, *c);
    }
    let cost = n - nax;
    println!("{}", cost);
}
//  [rust]
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let boalls: Vec<(i64,i64)> = (0..n).map(|_| (read(),read())).collect();
    let mut map = HashMap::new();

    if n == 1 {
        println!("1");
        return;
    }
    for i in 0..n{
        for j in i+1..n{
            let x = boalls[i].0 - boalls[j].0;
            let y = boalls[i].1 - boalls[j].1;
            let count = map.entry((x,y)).or_insert(0);
            *count += 1;
            //println!("x{} y{}",x,y);
        }
    }
    println!("{}",n - map.iter().max_by(|x,y|x.1.cmp(y.1)).unwrap().1);
}
//  [rust]
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let boalls: Vec<(i64,i64)> = (0..n).map(|_| (read(),read())).collect();
    let mut map = HashMap::new();

    for i in 0..n{
        for j in i+1..n{
            let x = boalls[i].0 - boalls[j].0;
            let y = boalls[i].1 - boalls[j].1;
            let count = map.entry((x,y)).or_insert(0);
            *count += 1;
            //println!("x{} y{}",x,y);
        }
    }
    println!("{}",n - map.iter().max().unwrap().1);
}
//  [swift]
let N = Int(readLine()!)!
let ball: [(Int, Int)] = (0..<N).map { _ in
	let input = readLine()!.characters.split(" ").map{Int(String($0))!}
	return (input[0], input[1])
}
var dic = [String : Int]()
for i in ball {
	for j in ball {
		if i != j {
			let key = "\(i.0 - j.0),\(i.1 - j.1)"
			dic[key] = (dic[key] ?? 0) + 1
		}
	}
}
print(N - (dic.values.maxElement() ?? 0))
//  [swift]
let N = Int(readLine()!)!
let ball: [(Int, Int)] = (0..<N).map { _ in
	let input = readLine()!.characters.split(" ").map{Int(String($0))!}
	return (input[0], input[1])
}
var dic = [String : Int]()
for i in ball {
	for j in ball {
    	if i != j {
			let key = "\(i.0 - j.0),\(i.1 - j.1)"
			dic[key] = (dic[key] ?? 0) + 1
        }
	}
}
print(N - (dic.values.maxElement() ?? 0))
//  [swift]
import Foundation


func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}

func main() {
    let n = Int(readLine()!)!

    let points = (1...n).map { _ -> (Int, Int) in
        let xy = readWords { Int($0)! }
        let x = xy[0]
        let y = xy[1]

        return (x, y)
    }

    var distances = [[Int]: Int]()
    for (p, q) in points {
        for (b, d) in points {
            if (p, q) == (b, d) {
                continue
            }
            let pb = p - b
            let qd = q - d
            distances[[pb, qd], default: 0] += 1
        }
    }
    let v = distances.values.max()!
    print(n - v)
}


main()
//  [swift]
let N = Int(readLine()!)!
let ball: [(Int,Int)] = (0..<N).map { _ in
	let input = readLine()!.characters.split(" ").map{Int(String($0))!}
	return (input[0],input[1])
}
let dic: [String : Int] = ball.map { i in
	ball.filter{$0 != i}.map { j in
		let key = "\(i.0-j.0),\(i.1-j.1)"
		return (dic[key] ?? 0)+1
	}
}
print(N-(dic.values.maxElement() ?? 0))
//  [swift]
let N = Int(readLine()!)!
let ball: [(Int,Int)] = (0..<N).map { _ in
	let input = readLine()!.characters.split(" ").map{Int(String($0))!}
	return (input[0],input[1])
}
let dic: [String : Int] = ball.map { i in
	ball.filter{$0 != i}.map { j in
		let key = "\(i.0-j.0),\(i.1-j.1)"
		return dic[key]=(dic[key] ?? 0)+1
	}
}
print(N-(dic.values.maxElement() ?? 0))
//  [swift]
let N = Int(readLine()!)!
let ball: [(Int, Int)] = (0..<N).map { _ in
	let input = readLine()!.characters.split(" ").map{Int(String($0))!}
	return (input[0], input[1])
}
var dic = [String : Int]()
for i in ball {
	for j in ball {
		let key = "\(i.0 - j.0),\(i.1 - j.1)"
		dic[key] = (dic[key] ?? 0) + 1
	}
}
print(N - (dic.values.maxElement() ?? 0))
//  [typescript]
import * as fs from 'fs';

class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

class DisjointSet {
    components: number;
    parents: number[];
    constructor(readonly size: number) {
        this.components = size;
        this.parents = new Array(size).fill(-1).map((value, index) => index);
    }

    find(node: number): number {
        if (node != this.parents[node])
            this.parents[node] = this.find(this.parents[node]);
        return this.parents[node];
    }

    union(node1: number, node2: number): void {
        let parent1 = this.find(node1),
            parent2 = this.find(node2);
        if (parent1 != parent2) {
            this.parents[parent1] = parent2;
            this.components -= 1;
        }
    }
}

function solve(): number {
    let reader = new Reader();
    let N = reader.readInt();
    let points: {x: number, y: number}[] = [];

    for (let i = 0; i < N; i++) {
        let [x, y] = reader.readInts();
        points.push({x: x, y: y});
    }

    if (N == 1)
        return 1;

    let minComponents = Number.POSITIVE_INFINITY;

    for (let i = 0; i < N; i++) {
        for (let j = i + 1; j < N; j++) {
            let p = points[j].x - points[i].x,
                q = points[j].y - points[i].y;
            let disjointSet = new DisjointSet(N);
            for (let k = 0; k < N; k++) {
                for (let l = k + 1; l < N; l++) {
                    if ((points[l].x - points[k].x == p && points[l].y - points[k].y == q) ||
                        (points[k].x - points[l].x == p && points[k].y - points[l].y == q)) {
                        disjointSet.union(l, k);
                    }
                }
            }
            minComponents = Math.min(minComponents, disjointSet.components);
        }
    }
    return minComponents;
};

console.log(solve());
//  [typescript]
import { readFileSync } from 'fs'

function permutation<T>(list: T[], n: number = list.length) {
  if (n === 0) return []
  if (n === 1) return list.map(v => [v])

  let result = [] as T[][]

  list.forEach((value, index) => {
    const otherValues = list.filter((_, i) => i !== index)
    const remainList = permutation(otherValues, n - 1).map((list) => [value, ...list])

    result.push(...remainList)
  })

  return result
}

function main(input: string) {
  const [[N], ...list] = input.split('\n').map(v => v.split(' ').map(Number))

  if (N === 1) {
    console.log(1)
    return
  }

  const data = permutation(list, 2)
    .map(([[ax, ay], [bx, by]]) => [ax - bx, ay - by])
    .map(v => JSON.stringify(v))

  const countList = Array.from(new Set(data))
    .map(str => data.filter(v => v === str).length)

  const max = Math.max(...countList)

  console.log(N - max)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
import * as fs from 'fs';

class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

let reader = new Reader();
let N = reader.readInt();
let points: {x: number, y: number}[] = [];

for(let i=0; i<N; i++) {
    let [x, y] = reader.readInts();
    points.push({x: x, y: y});
}


class DisjointSet {
    components: number;
    parents: number[];
    constructor(readonly size: number) {
        this.components = size;
        this.parents = new Array(size).fill(-1).map((value, index) => index);
    }

    find(node: number): number {
        if (node != this.parents[node])
            this.parents[node] = this.find(this.parents[node]);
        return this.parents[node];
    }

    union(node1: number, node2: number): void {
        let parent1 = this.find(node1),
            parent2 = this.find(node2);
        if (parent1 != parent2) {
            this.parents[parent1] = parent2;
            this.components -= 1;
        }
    }
}

let minComponents = Number.POSITIVE_INFINITY;

for(let i=0; i<N; i++) {
    for(let j=i+1; j<N; j++) {
        let p = points[j].x-points[i].x,
            q = points[j].y-points[i].y;
        let disjointSet = new DisjointSet(N);
        for(let k=0; k<N; k++) {
            for(let l=k+1; l<N; l++) {
                if ((points[l].x-points[k].x == p && points[l].y-points[k].y == q) || 
                    (points[k].x-points[l].x == p && points[k].y-points[l].y == q)) {
                    disjointSet.union(l, k);
                }
            }
        }
        minComponents = Math.min(minComponents, disjointSet.components);
    }
}

console.log(minComponents);
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [[N], ...list] = input.split('\n').map(v => v.split(' ').map(Number))

  const data = list.map(([x, y]) => ({ x, y }))
  const hash = {} as Record<string, number>

  for (const a of data) {
    for (const b of data) {
      if (a === b) continue

      const key = `${a.x - b.x} ${a.y - b.y}`

      hash[key] = (hash[key] || 0) + 1
    }
  }

  const max = Math.max(...Object.keys(hash).map(key => hash[key]))

  console.log(N - max)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [[N], ...list] = input.split('\n').map(v => v.split(' ').map(Number))

  const data = list.map(([x, y]) => ({ x, y }))
  const hash = {} as Record<string, number>

  for (const a of data) {
    for (const b of data) {
      if (a === b) continue

      const key = `${a.x - b.x} ${a.y - b.y}`

      hash[key] = (hash[key] || 0) + 1
    }
  }

  const max = Math.max(...Object.values(hash))

  console.log(N - max)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [python]
a,b,c,d=map(int,input().split())
ans=max((a*c),(a*d),(b*c),(b*d))
print(ans)
//  [python]
a, b, c, d = map(int, input().split())
e = max(a*c,a*d,b*c,b*d)
print(e)
//  [python]
a, b, c, d = map(int, input().split())
print(max(a * c, a * d, b * c, b * d))
//  [python]
a, b, c, d = map(int, input().split())
ans = 0
if b != 0 and d != 0:
    if c < 0:
        ans = a * d
    else:
        ans = b * d
else:
    ans = min(a, b) * min(c, d)

print(ans)
//  [python]
arr = list(map(int, input().split()))
arr.sort()

mini = arr[0] * arr[1]
maxi = arr[-1] * arr[-2]

print(max(mini, maxi))
//  [python]
a,b,c,d = map(int, input().split())
import numpy as np
A = np.matrix([[a],[b]])
C = np.matrix([c,d])
print(A.shape)
print(C.shape)
X = np.dot(A,C)
print(np.max(X))
//  [java]

import java.util.*;
import java.io.*;

public class Main {
	static FastReader in = new FastReader();

	public static void main(String[] args) {
		solve();
	}

	static void solve() {
		long a = in.nextLong(), b = in.nextLong(), c = in.nextLong(), d = in.nextLong();
		
		long fin1 = Math.max(a * c, a * d);
		long fin2 = Math.max(b * c, b * d);
		System.out.println(Math.max(fin1, fin2));
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readarr(int abc) {
			int[] temp = new int[abc];
			for (int i = 0; i < abc; i++)
				temp[i] = nextInt();
			return temp;
		}
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		long a = Long.parseLong(strArr[0]);
		long b = Long.parseLong(strArr[1]);
		long c = Long.parseLong(strArr[2]);
		long d = Long.parseLong(strArr[3]);
		long max = a * c;
		if (max < a * d)
			max = a * d;
		if (max < b * c)
			max = b * c;
		if (max < b * d)
			max = b * d;
		System.out.println(max);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}
//  [java]
import java.awt.desktop.AboutHandler;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class template {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static StringBuilder sb = new StringBuilder("");

    boolean[] sieveOfEratosthenes(int n)
    {
        boolean isPrime[] = new boolean[n+1];
        Arrays.fill(isPrime , true);
        isPrime[0] = false;
        isPrime[1] = false;
        for(int i = 2; i * i <= n ; i++)
        {
            for(int j = 2 * i ; j <= n; j += i)
                isPrime[i] = false;
        }
        return isPrime;
    }

    static long modExpo(long x, long y , int mod) {
        if(y == 0) {
            return 1;
        }
        if((y&1) == 0) {
            return modExpo(x * x , y >> 1 , mod);
        }
        long res = modExpo(x , y - 1 , mod) * x;
        return res > mod ? res - mod : res;
    }

    static int gcd(int a , int b) {
        if(a % b == 0) {
            return b;
        }
        return gcd(b , a % b);
    }

    static long[] inputArray(int n) throws IOException {
        long a[] = new long[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0 ; i < n ; i++) {
            a[i] = Long.parseLong(st.nextToken());
        }
        return a;
    }

    static int search(int numbers[] , int target) {
        int endIndex = -1;
        int low = 0;
        int high = numbers.length - 1;
        while (low <= high) {
            int mid = (high - low) / 2 + low;
            if (numbers[mid] > target) {
                high = mid - 1;
            } else if (numbers[mid] == target) {
                endIndex = mid;
                low = mid + 1;
            } else {
                low = mid + 1;
                endIndex = mid;
            }
        }
        return endIndex;
    }


    public static void main(String[] args) throws IOException {
        PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
        pq.add(1);
        pq.add(3);
        pq.add(5);pq.add(2);
        pq.add(2);
        pq.add(2);
        pq.add(3);
        System.out.println(pq);
        pq.remove(2);
        System.out.println(pq);
    }

    public int findLeastNumOfUniqueInts(int[] a, int k) {
        int n = a.length;
        HashMap<Integer , Integer> freq = new HashMap<>();
        for(int i = 0 ; i < n ; i++) {
            if(freq.containsKey(a[i])) {
                freq.replace(a[i] , freq.get(a[i]) + 1);
            }
            else {
                freq.put(a[i] , 1);
            }
        }

        ArrayList<Integer> list = new ArrayList<>();
        for(Map.Entry<Integer , Integer> map : freq.entrySet()) {
            list.add(map.getValue());
        }
        Collections.sort(list);
        int i = 0;
        while(k > 0) {
            k -= list.get(i);
            i++;
        }
        return n-i;
    }


}
/*
10 5
1 2 3 4 5
5 3 2 3 5 3 1 2 3 2
 */
//  [java]
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int d=sc.nextInt();
    
    int x=a*c;
    int y=a*d;
    int z=b*c;
    int w=b*d;
    
    if(x>=y&&x>=z&&x>=w)
    {
    	System.out.println(x); 
    }else {
    	if(y>=z&&y>=w) {
    		System.out.println(y);
    	}else {
    		if(z>=w) {
    			System.out.println(z);
    		}else {
    			System.out.println(w);
    		}
    	}
    }
  }
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

#define mid ((l+r)>>1)

using namespace std;

int main()
{
	long long a[5];
	for(int i=1;i<=4;i++)scanf("%lld",&a[i]);
	long long ans=a[2]*a[4];
	ans=max(ans,a[1]*a[3]);
	ans=max(ans,a[1]*a[4]);
	ans=max(ans,a[2]*a[3]);
	printf("%lld",ans);
	return 0;
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, n, x, d, t, s, a, b, c, ans=0, po=0;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    ans = a*c;
    if(ans<a*d) ans = a*d;
    if(ans<b*c) ans = b*c;
    if(ans<b*d) ans = b*d;
    printf("%lld", ans);
    
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;


int main(){
    long a,b,c,d;
    cin >> a >> b >> c >> d;
    
    long v = a*c;
    if(a*d>v) v = a*d;
    if(b*c>v) v = b*c;
    if(b*d>v) v = b*d;
    cout << v << endl;

    return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long a[4], ans = -10000000000;
	for (int i = 0; i < 4; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 2; j < 4; j++) {
			ans = max(ans, a[i] * a[j]);
		}
	}
	cout << ans << endl;
	return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int a[4], ans = -1000000001;
	for (int i = 0; i < 4; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 2; j < 4; j++) {
			ans = max(ans, a[i] * a[j]);
		}
	}
	cout << max(ans, (long long int)0) << endl;
	return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int a[4], ans = -1000000001;
	for (int i = 0; i < 4; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 2; j < 4; j++) {
			ans = max(ans, a[i] * a[j]);
		}
	}
	cout << ans << endl;
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)

int main(void){
  long long int a,b,c,d;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
  long long int x,y,z,w;
  x = a*c;
  y = b*c;
  z = a*d;
  w = b*d;
  if(x<y) x=y;
  if(x<z) x=z;
  if(x<w) x=w;
  printf("%lld",x);
  return 0;
}
//  [c]
#include <limits.h>
#include <stdio.h>

int main(){
  int a, b, c, d, i;
  long long int x[4], max=LLONG_MIN;

  scanf("%d %d %d %d", &a, &b, &c, &d);
  x[0]=(long long int)a*c;
  x[1]=(long long int)a*d;
  x[2]=(long long int)b*c;
  x[3]=(long long int)b*d;
  for(i=0; i<4; i++)
    if(x[i]>max)
      max=x[i];
  printf("%lld\n", max);

return 0;}