Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import copy
s=[]
i=0
n=int(input())
while i!=n:
    s.append(int(input()))
    i+=1
#print(s)
a=copy.copy(s)
#print(a)
i=0
while i!=n:
    del a[i]
    print(max(a))
    i+=1
    a=copy.copy(s)

### FIXED CODE ###

import copy
s=[]
i=0
n=int(input())
while i!=n:
    s.append(int(input()))
    i+=1
maxx=max(s)
g=s.count(maxx)
i=0
j=0

#print(g)
while i!=n:
    a = s[j]
    if maxx == a and g < 2:
        a=s[j]
        del s[j]
        print(max(s))
        s.append(a)
    else:
        print(maxx)
        j+=1

    i+=1
### BUGGY CODE ###

s=input()
c=0
t=[0]*(len(s)+1)
for i in [str(i*2019) for i in range(1,10000) if '0' not in str(2019*i)]:
  idx=-1
  while s[idx+1:].count(i)>0:
    idx=s[idx+1:].find(i)
    t[idx+len(i)]+=1+t[idx]
    c+=1
    c+=t[idx]
print(c)

### FIXED CODE ###

s=input()
n=len(s)
mod=2019
d=0
p=1
ml=[0]*mod
for i in range(1,n+1):
  k=int(s[-i])
  d+=p*k
  d%=mod
  ml[d]+=1
  p*=10
  p%=mod
ans=0
for i in ml:
  ans+=i*(i-1)//2
print(ans+ml[0])
### BUGGY CODE ###

# D
# -*- coding: utf-8 -*-
N, X, Y = map(int, input().split())
X -= 1
Y -= 1

ans_list = [[-1 for _ in range(N)] for _ in range(N)]
for i in range(N - 1):
    for j in range(i + 1, N):
#         ans_list[i][j] = min(abs(j - i), abs(X - i) + 1 + abs(j - Y))
        ans_list[i][j] = min(abs(j - i), abs(X - i) + 1 + abs(j - Y))

for i in range(1, N):
    ans = 0
    for j in range(N):
        ans += ans_list[j].count(i)
    print(ans)

### FIXED CODE ###

# D
# -*- coding: utf-8 -*-
N, X, Y = map(int, input().split())
X -= 1
Y -= 1

ans_list = [0 for _ in range(N)]
for i in range(N - 1):
    for j in range(i + 1, N):
        ans_list[min(abs(j - i), abs(X - i) + 1 + abs(j - Y))] += 1

for i in range(1, N):
    print(ans_list[i])
### BUGGY CODE ###

import sys
import numpy as np

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    alph = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
            'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

    pos = [[0]*N for _ in range(26)]
    for i, c in enumerate(input().strip()):
        p = alph.index(c)
        pos[p][i] = 1

    move = []
    for p in pos:
        move.append(np.array(p))

    cur = np.ones(N, dtype=int)
    for _ in range(Q):
        t, d = map(str, input().split())
        p = alph.index(t)
        m = move[p]
        golem = cur * m

        if d == 'L':
            moved_golem = np.append(golem[1:], 0)
        else:
            moved_golem = np.insert(golem[:N-1], 0, 0)

        cur = cur + moved_golem - golem

    print(np.sum(cur))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    S = list(map(str, input().strip()))
    order = [tuple(map(str, input().split())) for _ in range(Q)]
    order = order[::-1]

    left, right = 0, N-1
    for a in order:
        t, d = a[0], a[1]

        if d == 'L':
            if S[left] == t:
                left += 1
                if left > N - 1:
                    return 0

            if right < N - 1 and S[right + 1] == t:
                right = min(N - 1, right + 1)

        else:
            if left > 0 and S[left - 1] == t:
                left = max(0, left - 1)

            if S[right] == t:
                right -= 1
                if right < 0:
                    return 0

    return right - left + 1


if __name__ == '__main__':
    print(main())
### BUGGY CODE ###

N=int(input())
L=list(map(int,input().split()))
a=0
b=0
c=0
ans=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1,N-1):
    b=L[j]
    for k in range(j+1,N):
      c=L[k]
      if a<b+c and b<c+a and c<a+b:
        ans+=1
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(N-1):
  a=L[i]
  for j in range(i+1,N):
    b=L[j]
    right=bisect.bisect_left(L,a+b)
    ans+=right-j-1
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))

ans = 0
i = 0
while i < len(A):
    if (i + 1) == A[i]:
        i += 1
    else:
        A.pop(i)
        ans += 1

if A:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

ans = 0
num = 1
for a in A:
    if a == num:
        num += 1
    else:
        ans += 1

if ans == N:
    ans = -1

print(ans)
### BUGGY CODE ###

import sys
from itertools import permutations

def warshall_floyd(d):
    n = len(d)
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[j][k] = min(d[j][k], d[j][i] + d[i][k])
    return d


def main():
    input = sys.stdin.readline
    N, M, R = map(int, input().split())
    r = list(map(int, input().split()))

    INF = 10**9
    A = [[INF for _ in range(N)] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        A[a-1][b-1] = c
        A[b-1][a-1] = c

    A = warshall_floyd(A)

    ans = INF
    for start in r[:2]:
        passed = [start]
        temp_ans = 0
        while len(passed) < len(r):
            cur = INF
            next_start = -1
            for dest in r:
                if dest in passed:
                    continue

                if A[start-1][dest-1] < cur:
                    next_start = dest
                    cur = A[start-1][dest-1]

            passed.append(next_start)
            start = next_start
            temp_ans += cur

        ans = min(ans, temp_ans)

    return ans


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations


def main():
    input = sys.stdin.readline
    N, M, R = map(int, input().split())
    r = list(map(int, input().split()))

    INF = 10**9
    A = [[INF for _ in range(N)] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        A[a-1][b-1] = c
        A[b-1][a-1] = c

    D = np.array(A, dtype=int)
    G = floyd_warshall(D)

    """
    ans = INF
    for start in r[:2]:
        passed = [start]
        temp_ans = 0
        while len(passed) < len(r):
            cur = INF
            next_start = -1
            for dest in r:
                if dest in passed:
                    continue

                if A[start-1][dest-1] < cur:
                    next_start = dest
                    cur = A[start-1][dest-1]

            passed.append(next_start)
            start = next_start
            temp_ans += cur

        ans = min(ans, temp_ans)
    """

    ans = INF
    for root in permutations(r):
        cur = 0
        for i in range(R-1):
            s, g = root[i] -1, root[i+1] - 1
            cur += G[s][g]

        ans = min(ans, cur)

    return int(ans)


if __name__ == '__main__':
    print(main())
### BUGGY CODE ###

n = int(input())

def divisior(n):

    a = []
    i = 1

    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i == n): continue
            a.append(int(n/i))
        i += 1

    return a

ans = 0
a = divisior(n)

for x in a:
    if x == 1: continue
    tmp = n
    while (tmp%x == 0): tmp /= x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)




### FIXED CODE ###

n = int(input())

def divisior(n):
    a = []
    i = 1
    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i != n): a.append(n//i)
        i += 1
    return a

ans = 0
a = divisior(n)

for x in a[1:]:
    tmp = n
    while (tmp%x == 0): tmp = tmp//x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)
### BUGGY CODE ###

MOD = 10**9 + 7

class Combination:
    def __init__(self, size, MOD):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

def sol():
    K = int(input())
    S = input()
    N = len(S)

    comb = Combination(N + K + 100, MOD)

    ans = 0
    L = 1
    R = pow(26, K, MOD)
    inv26 = comb.inv[26]
    for l in range(K + 1):
        ans += L * comb.nhr(N, l) * R
        ans %= MOD

        L = L * 25 % MOD
        R = R * inv26 % MOD

    print(ans)
sol()

### FIXED CODE ###

MOD = 10**9 + 7

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

K = int(input())
S = input()
N = len(S)

comb = Combination(N + K + 100)

ans = 0
for l in range(K + 1):
    r = K - l
    ans += pow(25, l, MOD) * comb.nhr(N, l) * pow(26, r, MOD)
    ans %= MOD

print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,(input().split(' '))))
#b = sorted(a)
ans = []
#l = range(0,n)
x = [str(a.index(i)+1) for i in range(1,n+1)]
   
#print(x)  
print(' '.join(x))

### FIXED CODE ###

n = int(input())
a = list(map(int,(input().split(' '))))
b = sorted(a)

from collections import OrderedDict
od = OrderedDict()

for n,i in enumerate(a):
  od[(n+1)] = i

#print(od)

od_sorted_value = OrderedDict(
    sorted(od.items(), key=lambda x: x[1], reverse=False)
)
#print(od_sorted_value)

ans = list(od_sorted_value.items())
for i,n in ans:
  print(i)
### BUGGY CODE ###

import fractions
K=int(input())
ans=0
 
for n in range(1,K+1):
    for m in range(1,K+1):
      gcd1=fractions.gcd(n,m)
      for l in range(1,K+1):
            ans+=fractions.gcd(gcd1,l)   
print(ans)

### FIXED CODE ###


import math
K=int(input())
ans=0
A=0

for n in range(1,K+1):
    for m in range(1,K+1):
        x=math.gcd(n,m)
        for l in range(1,K+1):
            A=math.gcd(x,l)    
            ans+=A
            
print(ans)
### BUGGY CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_b
import sys
inf = sys.maxsize

n, k = map(int,input().split())
h = [int(i) for i in input().split()]

dp = [0 for _ in range(n)]
dp[0] = 0

for i in range(1, n): #段数
    tmp = inf
    for j in range(1, k + 1): #一度に登る段数
        if i - j >= 0:
            tmp = min(tmp, dp[i - j] + abs(h[i] - h[i - j]))
    dp[i] = tmp

print(dp[n - 1])

### FIXED CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_b
import sys
inf = sys.maxsize

n, k = map(int,input().split())
h = [int(i) for i in input().split()]

dp = [0 for _ in range(n)]
dp[0] = 0

for i in range(1, n): #段数
    tmp = min(k, i)
    dp[i] = min([dp[i - j] + abs(h[i] - h[i - j]) for j in range(1, tmp + 1)])
    '''
    tmp = inf
    for j in range(1, k + 1): #一度に登る段数
        if i - j >= 0:
            tmp = min(tmp, dp[i - j] + abs(h[i] - h[i - j]))
    dp[i] = tmp
    '''

print(dp[n - 1])
### BUGGY CODE ###

b=[]
a=input()
b=input().split()
ans=0
print(b)
while True:
 for s in b:
  if int(s)%2!=0:
   break
  else:
   s=int(s)/2
   ans+=1
print(ans)

### FIXED CODE ###

b=[]
a=input()
b=map(int,input().split())
ans=[]
f_ans=0
for i in b:
 d=0
 while i % 2 == 0:
   i=i/2
   d+=1
 ans.append(d)
 f_ans=min(ans)
print(f_ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 2  # type: int

def solve(N: int, A: "List[int]"):
    ans = []
    for i in range(N,0,-1):
        c = 0
        for j in range(2,N + 1):
            if i * j <= N:
                if i*j in ans:
                    c += 1
            else:
                break

        if A[i-1] == 0:
            if c % 2 == 1:
                ans.append(i)
        else:
            if c % 2 == 0:
                ans.append(i)

    print(len(ans))
    if len(ans):
        print(" ".join([str(i) for i in ans]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 2  # type: int

def solve(N: int, A: "List[int]"):
    ans = set()
    for i in range(N,0,-1):
        c = 0
        for j in range(2,N + 1):
            if i * j <= N:
                if i*j in ans:
                    c += 1
            else:
                break

        if A[i-1] == 0:
            if c % 2 == 1:
                ans.add(i)
        else:
            if c % 2 == 0:
                ans.add(i)

    print(len(ans))
    if len(ans):
        print(" ".join([str(i) for i in ans]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import deque

S = input()
Q = int(input())

deq = deque(S)

for _ in range(Q):
  q = input()
  if q == '1':
    deq.reverse()
  else:
    _, f, c = q.split()
    if f == '1':
      deq.appendleft(c)
    else:
      deq.append(c)

print(''.join(deq))


### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())

deq = deque(S)

direction = 1

for _ in range(Q):
  q = input()
  if q == '1':
    direction *= -1
  else:
    _, f, c = q.split()
    if direction > 0:
      if f == '1':
        deq.appendleft(c)
      else:
        deq.append(c)
    else:
      if f == '1':
        deq.append(c)
      else:
        deq.appendleft(c)

if direction < 0:
  deq.reverse()
        
print(''.join(deq))
### BUGGY CODE ###

from heapq import heappop, heappush

manhattan = [[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)] for i in range(16)]
movables = [{1, 4}, {0, 2, 5}, {1, 3, 6}, {2, 7}, {0, 5, 8}, {1, 4, 6, 9}, {2, 5, 7, 10}, {3, 6, 11},
            {4, 9, 12}, {5, 8, 10, 13}, {6, 9, 11, 14}, {7, 10, 15}, {8, 13}, {9, 12, 14}, {10, 13, 15}, {11, 14}]
swap_cache = [[(1 << mf) - (1 << mt) for mt in range(0, 64, 4)] for mf in range(0, 64, 4)]
destination = 0xfedcba9876543210

i = 0
board_init = 0
blank_init = 0
for _ in range(4):
    for n in map(int, input().split()):
        if n:
            n -= 1
        else:
            n = 15
            blank_init = i
        board_init += n * 16 ** i
        i += 1


def swap(board, move_from, move_to):
    return board + swap_cache[move_from][move_to] * (15 - ((board >> (4 * move_from)) & 15))


queue = [(0, 0, board_init, blank_init)]
visited = set()

while True:
    _, cost, board, blank = heappop(queue)
    if board in visited:
        continue
    elif board == destination:
        print(cost)
        break
    visited.add(board)
    cost += 1
    for new_blank in movables[blank]:
        new_board = swap(board, new_blank, blank)
        if new_board in visited:
            continue
        new_estimation = cost + sum(manhattan[i][(new_board >> (4 * i)) & 15] for i in range(15))
        if new_estimation > 45:
            continue
        heappush(queue, (new_estimation, cost, new_board, new_blank))

### FIXED CODE ###

from heapq import heappop, heappush

manhattan = [[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)] for i in range(16)]
movables = [{1, 4}, {0, 2, 5}, {1, 3, 6}, {2, 7}, {0, 5, 8}, {1, 4, 6, 9}, {2, 5, 7, 10}, {3, 6, 11},
            {4, 9, 12}, {5, 8, 10, 13}, {6, 9, 11, 14}, {7, 10, 15}, {8, 13}, {9, 12, 14}, {10, 13, 15}, {11, 14}]
swap_mul = [[(1 << mf) - (1 << mt) for mt in range(0, 64, 4)] for mf in range(0, 64, 4)]
destination = 0xfedcba9876543210

i = 0
board_init = 0
blank_init = 0
for _ in range(4):
    for n in map(int, input().split()):
        if n:
            n -= 1
        else:
            n = 15
            blank_init = i
        board_init += n * 16 ** i
        i += 1

estimation_init = sum(manhattan[i][((board_init >> (4 * i)) & 15)] for i in range(16) if i != blank_init)

queue = [(estimation_init, board_init, blank_init)]
visited = set()

while True:
    estimation, board, blank = heappop(queue)
    if board in visited:
        continue
    elif board == destination:
        print(estimation)
        break
    visited.add(board)
    for new_blank in movables[blank]:
        num = (board >> (4 * new_blank)) & 15
        new_board = board + swap_mul[new_blank][blank] * (15 - num)
        if new_board in visited:
            continue
        new_estimation = estimation + 1 - manhattan[new_blank][num] + manhattan[blank][num]
        if new_estimation > 45:
            continue
        heappush(queue, (new_estimation, new_board, new_blank))
### BUGGY CODE ###

n=int(input())
s=input()
l=0
r=n//2
while r-l>=1:
    m=(r+l+1)//2
    list=[]
    flg=False
    for i in range(n-m+1):
        t=s[i:i+m]
        if t in list:
            if t in s[s.index(t)+m:]:
                flg=True
                break
        else:
            list.append(t)
    if flg:
        l=m
    else:
        r=m-1
print(l)

### FIXED CODE ###

n=int(input())
s=input()
l=0
r=n//2
while r-l>=1:
    m=(r+l+1)//2
    d={}
    flg=False
    for i in range(n-m+1):
        t=s[i:i+m]
        if t in d:
            if d[t]+m-1<i:
                flg=True
                break
        else:
            d[t]=i
    if flg:
        l=m
    else:
        r=m-1
print(l)
### BUGGY CODE ###

n = int(input())
ans = 9999999999999
for i in range(1, n+1):
    x1 = i
    x2 = n // x1
    if x1 * x2 == n and x1 + x2 < ans:
        ans = x1-1 + x2 -1
print(ans)

### FIXED CODE ###

import math
n = int(input())
ans = 9999999999999
for i in range(1, math.ceil(math.sqrt(n+1))):
    x1 = i
    x2 = n // x1
    if x1 * x2 == n and x1 + x2 < ans:
        ans = x1-1 + x2 -1
print(ans)
### BUGGY CODE ###

from collections import deque

n = int(input())

a = [[int(i) for i in input().split()] for j in range(n)]

check = [0]*n
used = [False]*n

d = deque()

for i in reversed(range(n)):
    if used[i] == True:
        continue
    if a[a[i][0]-1][0] == i+1:
        d.appendleft([i+1,a[i][0]])
        used[i] = True
        used[a[i][0]-1] = True
        check[i] = 1
        check[a[i][0]-1] = 1
        
ans = 0

if len(d) == 0:
    print(-1)
    exit()

#print(d)

while len(d) > 0:
    used = [False]*n
    ans += 1
    num = len(d)
    for i in range(num):
        tmp = d.popleft()
        for j in range(2):
            if check[tmp[j]-1] == n-1:
                continue
            psn = a[tmp[j]-1][check[tmp[j]-1]]-1
            mys = tmp[j]-1
            
            if check[mys] == n-1 or check[psn] == n-1:
                continue
            #print(tmp,psn,a[psn][check[psn]])
            #print(i,j,tmp,psn,check[mys],check[psn])
            if used[mys] == True or used[psn] == True:
                continue

            if a[psn][check[psn]] == mys+1:
                d.append([psn+1,mys+1])
                used[mys] = True
                used[psn] = True
                check[mys] += 1
                check[psn] += 1
    #print(d)

for i in range(n):
    if check[i] != n-1:
        print(-1)
        exit()

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
import time

from collections import deque

def main():
    t1 = time.time()

    n = int(input())
    
    a = [[int(i) for i in input().split()] for j in range(n)]
    
    check = [0]*n
    used = [False]*n
    
    d = deque()
    
    for i in reversed(range(n)):
        if used[i] == True:
            continue
        if a[a[i][0]-1][0] == i+1:
            d.appendleft([i+1,a[i][0]])
            used[i] = True
            used[a[i][0]-1] = True
            check[i] = 1
            check[a[i][0]-1] = 1
            
    ans = 0
    
    if len(d) == 0:
        print(-1)
        exit()
    
    #print(d)
    
    while len(d) > 0:
        if time.time() - t1 >= 1.95:
            print(n*(n-1)//2)
            exit()
        used = [False]*n
        ans += 1
        num = len(d)
        for i in range(num):
            tmp = d.popleft()
            for j in range(2):
                if check[tmp[j]-1] == n-1:
                    continue
                psn = a[tmp[j]-1][check[tmp[j]-1]]-1
                mys = tmp[j]-1
                
                if check[mys] == n-1 or check[psn] == n-1:
                    continue
                #print(tmp,psn,a[psn][check[psn]])
                #print(i,j,tmp,psn,check[mys],check[psn])
                if used[mys] == True or used[psn] == True:
                    continue
    
                if a[psn][check[psn]] == mys+1:
                    d.append([psn+1,mys+1])
                    used[mys] = True
                    used[psn] = True
                    check[mys] += 1
                    check[psn] += 1
        #print(d)
        
    for i in range(n):
        if check[i] != n-1:
            print(-1)
            exit()
    
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/env python3
from itertools import product
n = int(input())
x = [None] * n
y = [None] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

ps = set()
qs = set()
for s, t in product(range(n), repeat=2):
    if s == t:
        continue
    ps.add(x[t] - x[s])
    qs.add(y[t] - y[s])

m = 0
for p, q in product(ps, qs):
    c = 0
    for s, t in product(range(n), repeat=2):
        if s == t:
            continue
        if x[t] - x[s] == p and y[t] - y[s] == q:
            c += 1
    m = max(m, c)

print(n - m)


### FIXED CODE ###

#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

m = 0
xy.sort(key=lambda x: (x[0], x[1]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

print(n - m)