Harryxun/stf_run huggingface dataset:
N = int(input())
li = []
for i in range(N):
    a = list(map(int,input().split()))
    li.append(a)
cross = []

##計算量に余裕があるので全探索します
for i in range(N):
    for j in range (i+1, N):
        a = [li[j][0]-li[i][0],li[j][1]-li[i][1]]
        cross.append(a) 

lencross = len(cross)

res = 0
ans = []

for i in range (lencross):
    res = 0
    for j in range (lencross):
        if cross[i] == cross[j]:
            res += 1
    ans.append(res)
maxa = max(ans)
print(N - maxa)   

### FIXED CODE ###

import sys
N = int(input())
li = []
if N == 1 or N == 2:
    a = list(map(int,input().split()))
    print(1)
    sys.exit()   

for i in range(N):
    a = list(map(int,input().split()))
    li.append(a)

cross = []

##計算量に余裕があるので全探索します
for i in range(N):
    for j in range (i+1, N):
        a = [li[j][0]-li[i][0],li[j][1]-li[i][1]]
        if a[0] <= 0 and a[1] <= 0:
            b = [abs(li[j][0]-li[i][0]),abs(li[j][1]-li[i][1])]
            cross.append(b)
        elif a[0] < 0 and a[1] >= 0:
            c = li[j][1]-li[i][1]
            b = [abs(li[j][0]-li[i][0]),-c]
            cross.append(b) ####
        else:
            cross.append(a) 
lencross = len(cross)

res = 0
ans = []

for i in range (lencross):
    res = 0
    for j in range (lencross):
        if cross[i] == cross[j]:
            res += 1
    ans.append(res)
reduce = max(ans)

print(N - reduce)
import sys

for input_line in sys.stdin:
    input_line = raw_input().split()
    input_line.sort(reverse=True)
    print ' '.join(input_line)

### FIXED CODE ###

import sys

for input_line in sys.stdin:
    input_line = input_line.split()
    input_line = [int(char) for char in input_line]
    input_line.sort(reverse=True)
    input_line = [str(num) for num in input_line]
    print ' '.join(input_line)
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.pop(num-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)

### FIXED CODE ###

N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N+1):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.remove(num+1-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)
s = str(input())

days = ['SUN','MON','TUE','WED','THU','FRI','SAT']

k=1
while k<=7:
  if s==days[k]:
    print(k)
  else:
    k+=1
    


### FIXED CODE ###

s = str(input())

days = ['SUN','MON','TUE','WED','THU','FRI','SAT']

print(7-days.index(s))
def main():
    a,b = input().split()
    a = int(a)
    b = double(b)
    print(int(a*b))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    a,b = input().split()
    b = b[0] + b[2:]
    print(int(a)*int(b)//100)

if __name__ == "__main__":
    main()
x, y, z = int(input().split())
if y*z>=x:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x, y, z = [int(a) for a in input().split()]
if y*z>=x:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
A = list(map(int, input().split()))

mini = min(A)
idx = N + 1
mid = N / 2

for i, a in enumerate(A):
  if a == mini and abs(idx - mid) > abs(i - mid):
    idx = i

ans = i // (K - 1)
rem = i % (K - 1)
if rem:
  ans += 1
  if (N - i - 1 - (K - rem)) // (K - 1) > 0:
    ans += (N - i - 1 - (K - rem)) // (K - 1)
    if (N - i - 1 - (K - rem)) % (K - 1) != 0:
      ans += 1
else:
  if (N - i - 1) // (K - 1) > 0:
    ans += (N - i - 1) // (K - 1)
    if (N - i - 1) % (K - 1) != 0::
        ans += 1
print(ans)

### FIXED CODE ###

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

mini = min(A)
idx = N + 1
mid = N / 2

for i, a in enumerate(A):
  if a == mini and abs(idx - mid) > abs(i - mid):
    idx = i

ans = i // (K - 1)
rem = i % (K - 1)
if rem:
  ans += 1
  if (N - i - 1 - (K - rem)) // (K - 1) > 0:
    ans += (N - i - 1 - (K - rem)) // (K - 1)
    if (N - i - 1 - (K - rem)) % (K - 1) != 0:
      ans += 1
else:
  if (N - i - 1) // (K - 1) > 0:
    ans += (N - i - 1) // (K - 1)
    if (N - i - 1) % (K - 1) != 0:
        ans += 1
print(ans)
INF = 1*((10**9)*5000 + 1)
n, k = map(int, input().split())
P = [*map(lambda x: int(x)-1, input().split())]
C = [*map(int, input().split())]

# print(n,k)
# print(P)
# print(C,end='\n\n')

vis = [False]*(n+1)
def dfs(i, c, sum_c=0):
    if vis[i]: return c, sum_c
    vis[i] = True
    c.append(C[i])
    sum_c += C[i]
    ret = dfs(P[i], c, sum_c)
    # vis[i] = False
    return ret

lst_costs = []
for i in range(n):
    costs, lp_c = dfs(i, [])
    if len(costs) == 0: continue
    lst_costs.append((costs,lp_c))

# print(*lst_costs,sep='\n',end='\n\n')

score = -INF
for costs, lp_c in lst_costs:
    # print(costs, lp_c)
    cnt, remain = divmod(k, len(costs))
    len_c = len(costs)
    for st in range(len_c):
        cost = -INF
        if lp_c <= 0:
            max_c = -INF
            sum_c = 0
            for d in range(len_c):
                i = (st + d) % len_c
                x = costs[i]
                # print(st,d,i,x)
                sum_c += x
                max_c = max(max_c, sum_c)
            cost = max_c
            # print('1. cost',cost)
        else: # lp_c > 0:
            if cnt == 0:
                max_c = -INF
                sum_c = 0
                for d in range(len_c):
                    i = (st + d) % len_c
                    x = costs[i]
                    sum_c += x
                    max_c = max(max_c, sum_c)
                cost = max_c
                # print('2. cost',cost)

            else: # cnt > 0
                cost = lp_c * cnt
                max_c = -INF
                sum_c = 0
                for d in range(remain):
                    i = (st + d) % len_c
                    x = costs[i]
                    sum_c += x
                    max_c = max(max_c, sum_c)
                cost = max_c + cost
                # print('3. cost',cost)

        score = max({score, cost})
print(score)



### FIXED CODE ###

n, k = map(int, input().split())
P = [*map(lambda x: int(x)-1, input().split())]
C = [*map(int, input().split())]

INF = 10**18
max_score = -INF
for st in range(n):
    lc = 0 # lap count
    lap_sc = 0 # lap score
    nx = st
    while True:
        lc += 1
        lap_sc += C[nx]
        nx = P[nx]
        if nx == st: break

    sum_sc = 0
    kc = 0
    while True:
        kc += 1
        if k < kc: break

        sum_sc += C[nx]
        score = sum_sc + max(0, lap_sc) * ((k - kc) // lc)
        max_score = max(max_score, score)

        nx = P[nx]
        if nx == st: break

print(max_score)

# print('===')
# print(n,k)
# print(P)
# print(C,end='\n\n')
from collections import deque
sx, sy = 0, 0
# h, w = 3, 3
# maze_ori = [["..#"],
#                ["#.."],
#                ["..."]]

# maze_ori = [list(i[0]) for i in maze]
h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]

def bfs():
    visited = [[-1]*w for _ in range(h)]
    queue = deque([[sx, sy]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [h-1,w-1]:
            return visited[y][x]
        
        for dy, dx in ([0,1], [1,0], [0, -1], [-1, 0]):
            ny, nx = y+dy, x+dx
            if 0<=ny<h and 0<=nx<w:
                if maze[ny][nx] == '.' and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[y][x] + 1
                    queue.append([ny, nx])
                    
black_num = 0
for i in maze:
    black_num += i.count("#")

print(h*w - bfs() -1 -black_num)


### FIXED CODE ###

from collections import deque
sx, sy = 0, 0
h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]

def bfs():
    visited = [[-1]*w for _ in range(h)]
    queue = deque([[sx, sy]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [h-1,w-1]:
            return visited[y][x]
        
        for dy, dx in ([0,1], [1,0], [0, -1], [-1, 0]):
            ny, nx = y+dy, x+dx
            if 0<=ny<h and 0<=nx<w:
                if maze[ny][nx] == '.' and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[y][x] + 1
                    queue.append([ny, nx])
                    
black_num = 0
for i in maze:
    black_num += i.count("#")
bfs = bfs()
if bfs is None:
    print(-1)
else:
    print(h*w - bfs -1 -black_num)
N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
s=[]
c=[]
for i in range(M):
  s.append(sc[i][0]-1)
  c.append(sc[i][1])

S=[s[0]]
C=[c[0]]
for i in range(1,M):
  if s[i] in S:
    if C[S.index(s[i])]==c[i]:
      continue
    else:
      print('-1')
      exit()
  else:
    S.append(s[i])
    C.append(c[i])

ans=[0]*(N)

for i in range(M):
  ans[s[i]]=c[i]

if len(ans)!=0 and ans[0]==0:
  print('-1')
  exit()

ANS=""
for i in range(N):
  ANS+=str(ans[i])
print(ANS)

### FIXED CODE ###

N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
if N==1:
  start=0
else:
  start=10**(N-1)

for i in range(start,10**N):
  n=str(i)
  cnt=0
  for j in range(M):
    if n[sc[j][0]-1]==str(sc[j][1]):
      cnt+=1
    else:
      break
  if cnt==M:
    print(n)
    exit()
print('-1')
import math
n = int(input())
a = list(map(int, input().split()))
v = a[0]
for aa in a[1:]:
    v = math.gcd(v, aa)
print(v)


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


n = int(input())
a = list(map(int, input().split()))
v = a[0]
for aa in a[1:]:
    v = gcd(v, aa)
print(v)
a_str, b_str = input.split()
a, b = int(a_str), int(b_str)

A = a_str*b
B = b_str*a

print(min(A, B))

### FIXED CODE ###

a_str, b_str = input().split()
a = int(a_str)
b = int(b_str)

A = a_str*b
B = b_str*a
 
print(min(A, B))
import math

a, b, c, k = map(int, input().split())

if k % 2 != 1:
    print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")


### FIXED CODE ###

import math

a, b, c, k = map(int, input().split())

if k % 2 != 1:
    if a-b == 0:
        print(0)
    else:
        print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    if a-b == 0:
        print(0)
    else:
        print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
# -*- coding: utf-8 -*-

tmp=list(map(int,input().split()))
tmp.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-

a,b=map(int,input().split())

if b<a:
    print(a-1)
else:
    print(a)
def is_include_0(x):
  if 0 in x:
    x.remove(0)


  if 0 in x:
    return is_include_0(x)
  else:
    return x
  

def main():
  N = int(input())
  monsters = list(map(int, input().split()))

  monsters = sorted(monsters)
  # print(monsters)

  last = 10000
  while True:
    # print('==============================')
    # print(monsters)
    for i in range(1, len(monsters)):
      monsters[i] = monsters[i] % monsters[0]

    # print(monsters)
    if 0 in monsters:
      # monsters.remove(0)
      monsters = is_include_0(monsters)
      monsters = sorted(monsters)

    # print(monsters)
    if len(monsters) == 2:
      # print('a')
      last = int(abs(monsters[1] - monsters[0]))
      monsters[0] = last
      monsters.remove(monsters[1])
      # print(monsters)

    if len(monsters) == 1:
      break
  print(monsters[0])

main()


### FIXED CODE ###

from fractions import gcd
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

a = A[0]
for b in A[1:]:
  # print(a)
  a = gcd(a, b)

print(a)
from fractions import gcd # for python3.4 or lower
from functools import reduce
 
#２つでの再酥油公倍数
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
def main():
    n = int(input())
    array = list(map(int, input().split()))
    lcm = lcm_list(array)
 
    total = 0
    for i,num in enumerate(array):
        total += lcm / num
    print(int(total%(10**9+7)))
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import fractions
    n = int(input())
    array = list(map(int, input().split()))
    lcm = array[0]
    for i in range(1, n):
        lcm = lcm * array[i] // fractions.gcd(lcm, array[i])

    total = 0
    for i,num in enumerate(array):
        total += lcm // num
    print(int(total%(10**9+7)))

if __name__ == '__main__':
    main()
N,K = map(int, input().split())
l = [input()]
l.sort(reverse = True)
toral = 0
for i in range(K):
  total += l[i]
print(total)


### FIXED CODE ###

N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
lrev = l[::-1]
print(sum(lrev[:K]))
s = input();s[3] = "8";print(s)

### FIXED CODE ###

print(input().replace("2017","2018"))
for s in range(n):
    s = s.lower(k)

print(s)


### FIXED CODE ###

N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))
n = inport()
if "7" in n:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
if "7" in n:
  print("Yes")
else:
  print("No")
data = input().split()
if int(data[0]) > 10:
  ans = data[1]
else:
  ans = 100 * (10 - data[0])

print(ans)


### FIXED CODE ###

data = input().split()

n = int(data[0])
r = int(data[1])

if n < 10:
  ans = r + 100 * (10 - n)
else:
  ans = r

print(ans)
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i=0;i<N;i++){
		cin >> vec.at(i);
	}
	sort(vec.begin(), vec.end());
	double ans = vec.at(0);
	for(int i=1;i<N;i++){
		ans = (ans+vec.at(i))/2;
	}
	cout << ans << endl;
}

### FIXED CODE ###

N = int(input())
li = list(map(int, input().split()))
sli = sorted(li)
temp = sli[0]
for i in range(N-1):
    temp = (temp+sli[i+1])/2
print(temp)
A, B = map(int,open(0).read().split('\n'))
if A!=1 and B!=1:
    print(1)
elif A!=2 and B!=2:
    print(2)
else:
    print(3)

### FIXED CODE ###

A=int(input())
B=int(input())
if A!=1 and B!=1:
    print(1)
elif A!=2 and B!=2:
    print(2)
else:
    print(3)
H, W = map(int, input().split())
h, w = map(int, input().split())

white_cells_int = H * W - ((h * W) + (w * H) - (h * w)
print(white_cells_int)


### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

white_cells_int = H * W - ((h * W) + (w * H) - (h * w))
print(str(white_cells_int))
A,B = map(input().split())
if A>B:
  print(">")
elif A==B:
  print("=")
else:
  print("<")

### FIXED CODE ###

A,B = input().split()
if A>B:
  print(">")
elif A==B:
  print("=")
else:
  print("<")
bilding = [[[0 for i in range(4)] for j in range(3)]for k in range(10)]

n = int(input())
i = 0
while i < n:
    b, f, r, v = map(int, raw_input().split())
    bilding[b][f][r] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
        print floar
    if i < 3:
        print "####################"
    i += 1

### FIXED CODE ###

bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b != 3:
        print("#"*20)
a = int(input())
b = int(input())

if a < b :
	print("a < b")
elif a > b:
	print("a < b")
else:
	print("a == b")

### FIXED CODE ###

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

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
k = int(input().split(" ")[1])
s = input()

arr = []
if s[0] is "0": 
  arr.append(0)
arr.append(1)
for i in range(1,len(s)):
  if s[i-1] is s[i]:
    arr[-1] += 1
  else:
    arr.append(1)
if s[-1] is "0": 
  arr.append(0)

t = 2*k+1
if t>len(s):
  print(len(s))
else:
  temp = sum(arr[0:t])
  m = temp
  for i in range(2,len(arr)-t+1,2):
    m = max(m,temp-arr[i-2]-arr[i-1]+arr[i+t-2]+arr[i+t-1])
  print(m)
#print(arr)

### FIXED CODE ###

arr = list(map(int,input().split(" ")))
a = arr[0]
b = arr[1]

if a==b:
  print(2*a)
else:
  print(2*max(a,b)-1)
import numpy as np
import math
"""
def search(min_,max_,A,B,arr):
#    print(min_,max_)
    if min_==max_:
        return min_
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    
    if len(tmp)==0:
        return search(min_,mid,A,B,arr)
    
    tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
    sum_=sum(list(tmp))
    if sum_<=mid:
        return search(min_,mid,A,B,arr)
    else:
        return search(mid+1,max_,A,B,arr)

    while True:
        if k<0:
            if mid==min_:
                return max_
            else:
                #failure
                return search(mid,max_,A,B,arr[:L])
        elif len(tmp)==0:
            #success
            return search(min_,mid,A,B,arr)
        x=-tmp[0]
        tmp=np.delete(tmp,0)
        k-=x//(A-B)+(x%(A-B)>0)
"""
        
    
N,A,B=list(map(int,input().split()))
arr=[]

for i in range(N):
    h=int(input())
    arr.append(h)
arr=sorted(arr,reverse=True)
arr=np.array(arr)

max_=arr[0]//B+1
min_=arr[-1]//A

while min_!=max_:
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
    sum_=sum(list(tmp))
    
    if sum_<=mid:
        max_=mid
    else:
        min_=mid+1

ans=search(min_,max_,A,B,arr)

print(ans)

### FIXED CODE ###

import math
"""
def search(min_,max_,A,B,arr):
#    print(min_,max_)
    if min_==max_:
        return min_
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    
    if len(tmp)==0:
        return search(min_,mid,A,B,arr)
    
    tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
    sum_=sum(list(tmp))
    if sum_<=mid:
        return search(min_,mid,A,B,arr)
    else:
        return search(mid+1,max_,A,B,arr)

    while True:
        if k<0:
            if mid==min_:
                return max_
            else:
                #failure
                return search(mid,max_,A,B,arr[:L])
        elif len(tmp)==0:
            #success
            return search(min_,mid,A,B,arr)
        x=-tmp[0]
        tmp=np.delete(tmp,0)
        k-=x//(A-B)+(x%(A-B)>0)
"""
        
    
N,A,B=list(map(int,input().split()))
arr=[]

for i in range(N):
    arr.append(int(input()))

max_=max(arr)//B+1
min_=min(arr)//A

d=A-B

while min_!=max_:
    mid=(max_+min_)//2
    
    sum_=0
    for x in arr:
        sum_+=max(0,math.ceil((x-mid*B)/d))
        
    if sum_<=mid:
        max_=mid
    else:
        min_=mid+1

print(min_)
from bisect import bisect,bisect_left


N,M = map(int,input().split())

d1 = {}
d2 = {}
for i in range(M):
    PY = list(map(int,input().split()))
    tmp = d1.get(PY[0],[])
    ins_pos = bisect(tmp,PY[1])
    tmp.insert(ins_pos,PY[1])
    d1[PY[0]] = tmp

for py in PY:
    s1 = str(py[0])
    s1 = ("0"*(6-len(s1)))+s1
    s2 = str(bisect_left(d[py[0]],py[1])+1)
    s2 = ("0"*(6-len(s2)))+s2

    print(s1+s2)


### FIXED CODE ###

N,M = map(int,input().split())
PY = [list(map(int,input().split()))+[i] for i in range(M)]

num = [0]*N
ans = [""]*M

PY.sort(key = lambda x:x[1])

for p,y,i in PY:
    num[p-1] += 1
    ans[i] = str(p).zfill(6) + str(num[p-1]).zfill(6)

for a in ans:
    print(a)
import numpy as np
n = int(input())
dp = [np.inf for _ in range(100000)]
dp[0] = 0
num = [1,6,9]
pow6 = [6**i for i in range(10) if 6**i <= n]
pow9 = [9**i for i in range(10) if 9**i <= n]

for i in range(n):
    for p6 in pow6:
        dp[i+p6] = min(dp[i+p6], dp[i]+1)
    for p9 in pow9:
        dp[i+p9] = min(dp[i+p9], dp[i]+1)
print(dp[n])

### FIXED CODE ###

n = int(input())
dp = [10**9]*30000000
dp[0] = 0
pow6 = [6**i for i in range(10) if 6**i <= n]
pow9 = [9**i for i in range(10) if 9**i <= n]

for i in range(n):
    for p6 in pow6:
        dp[i+p6] = min(dp[i+p6], dp[i]+1)
    for p9 in pow9:
        dp[i+p9] = min(dp[i+p9], dp[i]+1)
print(dp[n])
import string
a = set(string.ascii_lowercase)
S = input()
if sorted(list((S))) == list(string.ascii_lowercase):
    print("None")
else:
    for i in set(S):
        if i in S:
            a.remove(i)
    print(sorted(list(a))[0])

### FIXED CODE ###

import string
a = set(string.ascii_lowercase)
S = input()
if sorted(list(set(S))) == list(string.ascii_lowercase):
    print("None")
else:
    for i in set(S):
        if i in a:
            a.remove(i)
    print(sorted(list(a))[0])
a, b, x = map(int,raw_input().split())
cnt = 0

for i in range(a,b):
    if i % x = 0:
        cnt = cnt + 1

print int(cnt)

### FIXED CODE ###

# -*- coding: utf-8 -*-

x = raw_input()
a = x.split()[0]
s = x.split()[1]
b = x.split()[2]

print a[0]+s[0]+b[0]
X,N = map(int,input().split())
p = list(map(int,input().split()))
ans = []
p.sort()

diff_1 = abs(X-p[-1])
diff_2 = abs(X-p[1])
diff = max(diff_1,diff_2)

for x in range(1,diff+1):
	if X+x not in p:
		ans.append(X+x)
		
	if X-x not in p:
		ans.append(X-x)

ans.sort()
print(ans[1])

### FIXED CODE ###

X,N = map(int,input().split())
if N == 0:
	print(X)
else:
	p = list(map(int,input().split()))
	p.sort()

	diff_1 = abs(X-p[-1])
	diff_2 = abs(X-p[0])
	diff = max(diff_1,diff_2)


	for x in range(diff+2):
		if X-x not in p:
			print(X-x)
			break
		if X+x not in p:
			print(X+x)
			break
N = int(input())
p = [int(i) for i in input().split(" ")]
ans = 0

for i in range(0,N):
    if p[i] == (i+1):
        if p[i+1] == (i+2):
            t = p[i]
            p[i] = p[i+1]
            p[i+1] = t
            ans += 1
        else:
            ans += 1
            d = -1 if i == N-1 else 1
            t = p[i]
            p[i] = p[i+d]
            p[i+d] = t
            
print(ans)


### FIXED CODE ###

N = int(input())
p = [int(i) for i in input().split(" ")]
ans = 0

for i in range(0,N):
    if p[i] == (i+1):
        if i == N-1:
            ans += 1
        elif p[i+1] == (i+2):
            t = p[i]
            p[i] = p[i+1]
            p[i+1] = t
            ans += 1
        else:
            ans += 1
            t = p[i]
            p[i] = p[i+1]
            p[i+1] = t
            
print(ans)