from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
import sys
input=sys.stdin.readline
def inp():
    return int(input())
def st():
    return input().rstrip('\n')
def lis():
    return list(map(int,input().split()))
def ma():
    return list(map(int,input().split()))
t=inp()
while(t):
    t-=1
    n=inp()
    x=n%10
    s=10*(x-1)
    l=len(str(n))
    s+=(l*(l+1))//2
    print(s)


rn=lambda:int(input())
rl=lambda:list(map(int,input().split()))
rns=lambda:map(int,input().split())
rs=lambda:input()
yn=lambda x:print('Yes') if x else print('No')
YN=lambda x:print('YES') if x else print('NO')

for _ in range(rn()):
    x=rs()
    n=int(x[0])
    ans=10*(n-1)
    for i in range(len(x)+1):
        ans+=i
    print(ans)


for _ in range(int(input())):
	n=int(input())
	ans=0
	for i in range(1,10):
		f=0
		for j in range(1,5):
			k=int(str(i)*j)
			ans+=len(str(k))
			if k==n:f=1;break
		if f:break
	print(ans)


import sys
input = sys.stdin.readline

def main():
    x = input().strip()
    n = int(x[0])
    l = len(x)
    ans = 10 * (n - 1) + l * (l + 1) // 2
    print(ans)

for _ in range(int(input())):
    main()


for t in range(int(input())):
    x = input()
    ans = []
    for i in range(1,10):
        for j in range(1,5):
            ans.append(str(i)*j)
    cnt = 0
    for i in ans:
        if i==x:
            cnt+=len(i)
            break
        else:
            cnt+=len(i)
    print(cnt)


t = int(input())
for _ in range(t):
    x = input()
    ans = 0
    ans += (int(x[0])-1)*10
    ans += len(x)*(len(x)+1)//2
    print(ans)


for __ in range(int(input())):
    n = input()
    ans = (int(n[0]) - 1) * 10 + 1
    if len(n) >= 2:
        ans += 2
    if len(n) >= 3:
        ans += 3
    if len(n) >= 4:
        ans += 4
    print(ans)


import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
#INF = float('inf')
mod = int(1e9)+7

for t in range(int(data())):
    s=data()
    ans=10*int(s[0])-10+(len(s)*(len(s)+1))//2
    out(ans)


for _ in range(int(input())):
    x = int(input())

    c = 0
    for i in range(1, 10):
        k = i

        while i <= 10000:
            c += len(str(i))

            if i == x:
                break

            i *= 10
            i += k

        else:
            continue

        break

    print(c)


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math
def geti(): return list(map(int, input().strip().split()))
def getl(): return list(map(int, input().strip().split()))
def gets(): return input()
def geta(): return int(input())
def print_s(s): stdout.write(s+'\n')

def solve():
    for _ in range(geta()):
        a=geta()
        ans=0
        ans=10*(a%10-1)
        while a:
            ans+=len(str(a))
            a//=10
        print(ans)

def __starting_point():
    solve()

__starting_point()


t=int(input())
for _ in range(t):
    x=input()
    a=int(x[0])
    b=len(x)
    print(10*(a-1)+(b*(b+1))//2)


import math
import string
import random
from random import randrange
from collections import deque
from collections import defaultdict

def solve(n):
    ans = 0

    k = n%10

    ans += 10*(k-1)

    f = len(str(n))

    for i in range(1, f+1):
        ans += i

    print(ans)
    return

def main():
    t = int(input())
    while t>0:
        t-=1

        n = int(input())
        # s = input().strip()
        # x,y = map(int, input().strip().split(" "))
        # arr = list(map(int, input().strip().split(" ")))

        solve(n)

    return

def test():
    arr_size = 25
    test_cases = 100
    min_range = -100
    max_range = 100
    str_size = 30
    step = 1

    for i in range(test_cases):
        k = []
        # s = ''.join(random.choices(string.ascii_lowercase, k = str_size))

        for j in range(arr_size):
            num = randrange(min_range, max_range, step)
            k.append(num)

        solve(n, arr)
        print("<-------- DEBUG ----------->")

    return

def __starting_point():
    main()
    # test()

__starting_point()


import sys
input=sys.stdin.readline
from collections import defaultdict as dc
from bisect import bisect_right
import math
for _ in range(int(input())):
    n=int(input())
    x=n%10
    c=10*(x-1)
    s=str(n)
    for i in range(len(s)):
        c+=i+1
    print(c)


for _ in range(int(input())):
    s=input()
    ans=10*(int(s[0])-1)
    l=len(s)
    if l==1:
        ans+=1
    elif l==2:
        ans+=3
    elif l==3:
        ans+=6
    else:
        ans+=10
    print(ans)


t=int(input())
for i in range(t):
    n=input()
    z=len(n)
    k=int(n)%10
    print(round((k-1)*10+(z*(z+1))/2))


import math
test = int(input())
for t in range(test):
    tt = 0
    pp = 0
    cc = ""
    ss = ""
    dd = 1
    cnttt = 0
    #write yoour code here
    x = int(input())
    a = x;cnt = 0
    while(a!=0):
        a=a//10
        cnt+=1
    a = x%10
    ans = (a-1)*10+cnt*(cnt+1)//2
    print(ans)


'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input().rstrip()
def mi():return list(map(int,input().split()))
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
# mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file = 1

def solve():

    for _ in range(ii()):

        s = si()
        x = [1,3,6,10]
        n = len(s)
        x1 = int(s[0])
        print(10*(x1-1) + x[n-1])

def __starting_point():

    if(file):

        if path.exists('input.txt'):
            sys.stdin=open('input.txt', 'r')
            sys.stdout=open('output.txt','w')
        else:
            input=sys.stdin.readline
    solve()

__starting_point()


t = int(input())

for _ in range(t):
    n = int(input())
    counting = 0
    is_done = False
    for i in range(1,10):
        for c in range(1,5):
            curr_int = int(str(i) * c)
            counting += c
            if curr_int == n:
                print(counting)
                is_done= True
                break

        if is_done:
            break


for _ in range(int(input())):
    n = input()
    c = int(n[0])
    ans = (c - 1) * 10
    k = len(n)
    for i in range(1, k + 1):
        ans += i
    print(ans)


def main():
    x = int(input())
    n = int(str(x)[0])
    l = len(str(x))
    ans = 10 * (n-1)
    ans += l * (l+1) // 2
    print(ans)

for _ in range(int(input())):
    main()


for _ in range(int(input())):
    x = int(input())
    a = x;cnt = 0
    while(a!=0):
        a=a//10
        cnt+=1
    a = x%10
    ans = (a-1)*10+cnt*(cnt+1)//2
    print(ans)


t = int(input())

for test in range(t):
    x = int(input())
    a = len(str(x))
    print((x % 10 - 1) * 10 + a * (a + 1) // 2)


import sys

def read(func=int):
    return func(sys.stdin.readline().strip())

def readList(func=int):
    return list(map(func, sys.stdin.readline().strip().split()))

t = read()
for _ in range(t):
    num = read()
    tot = ((num % 10) - 1) * 10
    for i in range(len(str(num))):
        tot += i + 1
    print(tot)


import bisect

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

index = bisect.bisect_left(A,X)
ans = min(M-index,index)
print(ans)


n,m,x=map(int, input().split())
a=[int(i) for i in input().split()]

count_1=0
for i in range(x):
    if i in a:
        count_1+=1

count_2=0
for i in range(x,n):
    if i in a:
        count_2+=1

print(min(count_1, count_2))


# B - Toll Gates
# https://atcoder.jp/contests/abc094/tasks/abc094_b

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

cost1 = 0
cost2 = 0

for i in range(x, 0, -1):
    if i in a:
        cost1 += 1

for i in range(x, n):
    if i in a:
        cost2 += 1

cost = [cost1, cost2]
print((min(cost)))


# 094b

def atc_094b(NMX: str, Ai_input: str) -> int:
    N, M, X = list(map(int, NMX.split(" ")))
    Ai = [int(ai) for ai in Ai_input.split(" ")]

    up_cost = 0
    down_cost = 0

    for i in range(X + 1, N + 1):
        if i in Ai:
            up_cost += 1
    for i in range(X - 1, 0, -1):
        if i in Ai:
            down_cost += 1
    return min(up_cost, down_cost)

NMX_input_value = input()
Ai_input_value = input()
print((atc_094b(NMX_input_value, Ai_input_value)))


n,m,x=map(int,input().split())
am=sorted(map(int,input().split()))
print(min(len(list(filter(lambda a:a<x,am))),len(list(filter(lambda a:x<a,am)))))


lst = input().split()
N = int(lst[0])
M = int(lst[1])
X = int(lst[2])
L = input().split()

cost_0 = 0
for n in L:
   if 0 < int(n) < X:
      cost_0 += 1
   elif X < int(n):
      break

cost_N = 0
for n in L:
   if X < int(n) < N:
      cost_N += 1

print(min([cost_0, cost_N]))


n,m,x = map(int,input().split())
a = list(map(int,input().split()))
root0 = 0
rootn = 0
for i in range(1,x):
  if i in a:
    root0 += 1
for i in range(x+1,n+1):
  if i in a:
    rootn += 1
print(min(root0,rootn))


#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,m,x = map(int,input().split())
    maps=[]
    maps=list(map(int,input().split()))
    dp=[0]*(n+1)
    left=0
    right=0

    for i in maps:
        dp[i]=1

    left = sum(dp[x:])
    right = sum(dp[:x])

    print(min(left,right))

def __starting_point():
    main()
__starting_point()


import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n, m, x = [int(num) for num in lines.pop(0).split(" ")]
a_list = [int(num) for num in lines.pop(0).split(" ")]

for i in range(m):
    if a_list[i] > x:
        break

ans = min(i, m - i)
print(ans)


total_square, total_toll_gate, current_square = map(int, input().split())
toll_gate_square = list(map(int, input().split()))
route1 = 0
route2 = 0
for i in range(total_toll_gate):
    if toll_gate_square[i] < current_square:
        route1 += 1
    else:
        route2 += 1
print(min(route1, route2))


# B - Toll Gates

# N M X
N, M, X = list(map(int, input().split()))
my_list = list(map(int, input().split(maxsplit=M)))
count_start = 0
count_goal = 0

# 0へ行くパターン
for i in range(1, X):
    if i in my_list:
        count_start += 1

for i in range(X, N):
    if i in my_list:
        count_goal += 1

if count_start >= count_goal:
    answer = count_goal
else:
    answer = count_start

print(answer)


n,m,x=map(int,input().split())
A=list(map(int,input().split()))
print(min(sum([a<x for a in A]),sum([a>x for a in A])))


n,m,x = map(int,input().split())
a=list(map(int,input().split()))
cnt1, cnt2 = 0, 0
for i in range(m):
  if 0 <= a[i] < x:
    cnt1 += 1
  if x < a[i] <= a[-1]:
    cnt2 += 1
print(min(cnt1, cnt2))


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

X_high = 0
X_low = 0

for i in range(X, N + 1):
    if i in A:
        X_high += 1

for i in range(0, X + 1):
    if i in A:
        X_low += 1

print(min(X_high, X_low))


N,M,X=map(int,input().split())
Ai=list(map(int,input().split()))

goto_0=0
goto_N=0

for i in range(X,0,-1):
    if i in Ai:
        goto_0 += 1

for i in range(X,N):
    if i in Ai:
        goto_N += 1

print(min(goto_0,goto_N))


N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
l1 = []
l2 = []

for i in A:
    if X > i:
        l1.append(i)
    else:
        l2.append(i)

print((min(len(l1), len(l2))))


def tool_gate(now: int, gate_list: list) -> int:
    back_count = sum(i < now for i in gate_list)
    forward_count = sum(i > now for i in gate_list)
    return min(back_count, forward_count)

def __starting_point():
    n, m, now = list(map(int, input().split()))
    gate_list = list(map(int, input().split()))
    print((tool_gate(now, gate_list)))

__starting_point()


n,m,x = map(int,input().split())
a =list(map(int,input().split()))
start = sum(i>x for i in a)
end = sum(i<x for i in a)
print(min(start,end))


import sys
input = sys.stdin.readline

N,M,X = map(int,input().split())
A = list(map(int,input().split()))
if A[int(M/2)] > X:
  b = [i for i in A if i < X]
else:
  for i in A[::-1]:
     b = [i for i in A if i > X]

print(min(len(b),M - len(b)))


# 数値の取得
last,fee,cur = map(int,input().split())
feesqu = list(map(int,input().split()))
total = len(feesqu)

# コストの最小値を出力
tcost = 0
gcost = 0
for cnt in range(0,total,1):
    if feesqu[cnt] < cur:
        tcost += 1
gcost = total - tcost
print(min(tcost,gcost))


N, M, X = list(map(int, input().split()))
a_point = list(map(int,input().split()))
lg = 0
sl = 0
for i in range(len(a_point)):
    if X < a_point[i]:
        lg  += 1
    else:
        sl += 1

if lg > sl:
    print(sl)
else:
    print(lg)


N, M, X = map(int,input().split())
fee = list(map(int,input().split()))
result_1 = []
result_2 = []

for i in fee:
    if i > X:
        result_1.append(i)
    else:
        result_2.append(i)

result = (min(len(result_1) ,len(result_2)))
print(result)


n,m,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in a:
    if i<x:
        ans+=1
    else:
        break
print(min(ans,m-ans))


n, m, x = list(map(int, input().split()))
a_lst = list(map(int, input().split()))

cost1 = 0
cost2 = 0
for i in range(x, n+1):
  if i in a_lst:
    cost1 += 1
for i in range(x, -1, -1):
  if i in a_lst:
    cost2 += 1
print((min(cost1, cost2)))


import bisect

def answer(n: int, m: int, x: int, a: []) -> int:
    i = bisect.bisect_left(a, x)
    return min(i, len(a) - i)

def main():
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))
    print(answer(n, m, x, a))

def __starting_point():
    main()
__starting_point()


N, M, X = [int(i) for i in input().split()]
AS = [int(i) for i in input().split()]

cnt1 = 0
for i in range(0, X):
  if i in AS:
    cnt1 += 1

cnt2 = 0
for i in range(X+1, N+1):
  if i in AS:
    cnt2 += 1

print((cnt1 if cnt1 < cnt2 else cnt2))


# 入力
n, m, x = map(int, input().split())
a = list(map(int, input().split()))

goto_goal_0 = 0 # 0までのコスト
goto_goal_n = 0 # nまでのコスト

# x から 0 へ向かうコストを計算
for i in range(x - 1, 0, -1):   # x-1 番目から順番にデクリメントしながらforループ
    if i in a:
        goto_goal_0 += 1
        # print("0 is {}".format(goto_goal_0))

# x から n へ向かうコストを計算
for i in range(x, n + 1):   # x 番目から順番にインクリメントしながらforループ
    if i in a:
        goto_goal_n += 1
        # print("n is {}".format(goto_goal_n))

if goto_goal_0 < goto_goal_n:
    print(goto_goal_0)
else:
    print(goto_goal_n)


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

L = 0
R = 0

for ai in A:
    if ai < X:
        L = L + 1
    else:
        R = R + 1
print(min(L, R))


import sys
input = sys.stdin.readline

N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
count = 0
if A[int(M/2)] > X:
  for i in A:
    if i < X:
      count += 1
    else:
      break
else:
  for i in A[::-1]:
    if i > X:
      count += 1
    else:
      break

print((min(count,M - count)))


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

right = [int(i) for i in A if i > X]
left = [int(i) for i in A if i < X]

r = len(right)
l = len(left)

if r < l:
    print(r)

else:
    print(l)


a = [int(c) for c in input().split()]
N=a[0]
M=a[1]
X=a[2]
A = [int(c) for c in input().split()]
A2 = [0]*(N+1)
for i in range(M):
    A2[A[i]] = 1

cnt = X
cost1 = 0
while cnt < N+1:
    cost1+=A2[cnt]
    cnt+=1

cnt = X
cost2 = 0
while cnt > 0:
    cost2+=A2[cnt]
    cnt-=1

if cost1<cost2:
    print(cost1)
else:
    print(cost2)


a=input().split()
N=int(a[0])
M=int(a[1])
X=int(a[2])
ryokinjo=[]
b=input().split()
for i in range(len(b)):
  ryokinjo.append(int(b[i]))
count1=0
count2=0
for i in range(len(ryokinjo)):
  if ryokinjo[i]<X:
    count1+=1
  if ryokinjo[i]>X:
    count2+=1
print((min([count1,count2])))


a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=list(map(int,input().split()))
e=0
f=0
for i in range(b):
  if d[i]>c:
    e=e+1
  if d[i]<c:
    f=f+1
if e>f:
  print(f)
else:
  print(e)


N,M,X=map(int,input().split())
A=list(map(int,input().split()))
cnt=len([a for a,i in enumerate(A) if i>=X])
cnt=min(cnt,M-cnt)
print(cnt)


n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
x1 = x
x2 = x

while x1 < n+1:
    x1 += 1
    if x1 in a:
        cnt1 += 1

while x2 > 0:
    x2 -= 1
    if x2 in a:
        cnt2 += 1

if cnt1 < cnt2:
    ans = cnt1
else:
    ans = cnt2

print(ans)


N,M,X=map(int,input().split())
Ai=list(map(int,input().split()))

goto_0=0
goto_N=0

for i in range(0,X):
    if i in Ai:
        goto_0 += 1

for i in range(X,N):
    if i in Ai:
        goto_N += 1

print(min(goto_0,goto_N))


n, m, x = map(int, input().split())
a = list(map(int, input().split()))

acc = [0] * (n + 1)
for i in a:
    acc[i] = 1
print(min(sum(acc[:x]), sum(acc[x:])))


num, count_station, my_position = list(map(int, input().split()))
a = list(map(int, input().split()))
station_list = list(a)
space = num + 1
first_me_cost = 0
last_me_cost = 0

distance_me_first = my_position
distance_me_last = num - my_position

for i in station_list:
    if 1 <= i <= my_position - 1:
        first_me_cost += 1

for i in station_list:
    if my_position + 1 <= i < num:
        last_me_cost += 1

if first_me_cost > last_me_cost:
    print(last_me_cost)
elif last_me_cost > first_me_cost:
    print(first_me_cost)
elif last_me_cost == first_me_cost:
    print(first_me_cost)


n,m,x=map(int,input().split())
a=list(map(int,input().split()))
c=x
ans=0
ans1=0
while c:
  ans+=c in a
  c-=1
while x<n:
  ans1+=x in a
  x+=1
print(min(ans,ans1))


N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
B = sorted(A)
C = [0]*(N+1)
cnt_1 = 0
cnt_2 = 0

for i in range(M):
    C[B[i]] += 1

for j in range(1, N-X):
    cnt_1 += C[X+j]

for k in range(1, X+1):
    cnt_2 += C[X-k]

cnt = [cnt_1, cnt_2]

print((min(cnt)))


n,m,x = list(map(int,input().split()))
a = list(map(int,input().split()))
k = n-1
for i in range(m):
    if a[i] > x:
        k = i
        break
if k==0 or k==n-1:
    print('0')
    return
else:
    print((min(k,m-k)))


S_list = [input() for i in range(2)]
N, M, X= map(int,S_list[0].split())
A_list = list(map(int,S_list[1].split()))

A_goal_N = [i for i in A_list if X < i and i < N]
A_goal_0 = [i for i in A_list if 0 < i and i < X]
result = min(len(A_goal_N),len(A_goal_0))
print(result)


N, M, X, *A = map(int, open(0).read().split())

l = [0] * N
for a in A:
    l[a-1] = 1

print(min(sum(l[:X]), sum(l[X:])))


n, m, x = list(map(int,input().split()))
a = list(map(int,input().split()))

goal_0 = 0
goal_1 = 0

for i in range(x,0,-1):
    if i in a:
        goal_0 += 1

for i in range(x,n+1,1):
    if i in a:
        goal_1 += 1

if goal_0 < goal_1:
    print(goal_0)
else:
    print(goal_1)


n,m,x=map(int,input().split())
a=list(map(int, input().split()))
p = 0
q = 0
for i in a:
    if i > x:
        p +=1
    elif i < x:
        q +=1
print(min(p,q))


#ABC094 B 3番目が通らない
n,m,x=map(int,input().split())
List=[int(i) for i in input().split()]
lcost=0
rcost=0
for a in List:
    if a<x:
        lcost+=1

for b in List:
    if b>x:
        rcost+=1
print(min(lcost,rcost))


n,m,x = list(map(int, input().split()))
a = list(map(int, input().split()))
c0 = 0
cN = 0
for A in a:
    if A > x:
        cN += 1
    elif A < x:
        c0 += 1
print(min(c0, cN))


n, m, x = map(int, input().split())
a = list(map(int, input().split()))

def answer(n: int, m: int, x: int, a:list) -> int:
    left = 0
    right = 0
    for i in a:
        if i < x:
            left += 1
        else:
            right += 1
    return min(left, right)

print(answer(n, m, x, a))


N, M, X = map(int,input().split())
L = list(map(int,input().split()))
s = 0
b = 0
for i in L:
    if i > X:
        s += 1
    else:
        b += 1

if s >= b:
    print(b)
else:
    print(s)


N, M, X = list(map(int,input().split()))
S = list(map(int,input().split()))
Fees = list(S)
Goal1 = []
Goal2 = []
count1 = 0
count2 = 0
point0 = 0

for i in range(X):
    point0 += 1
    Goal1.append(point0)
# print(Goal1)

for j in range(N-X):
    X += 1
    Goal2.append(X)
# print(Goal2)

for fee in Fees:
    if fee in Goal1:
        count1 += 1
    if fee in Goal2:
        count2 += 1

if count1 >= count2:
    print(count2)
if count1 < count2:
    print(count1)

# Fee = list(S)
# print(Fee)
# count1 = 0
# count2 = 0
# for i in range(N-X):
#     X += 1
#     if X in Fee:
#         count1 += 1
# print(X)
# for j in range(N):
#     X -= 1
#     if X in Fee:
#         count2 += 1
#
# if count1 <= count2:
#     print(count1)
# if count1 > count2:
#     print(count2)


n, m, x = map(int, input().split())

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

r = 0
l = 0

for i in a:
    if i > x:
        r += 1
    elif i < x:
        l += 1

print(min(l,r))


from bisect import bisect_left

def main():
    N, M, X = list(map(int, input().split()))
    A = list(map(int, input().split()))
    mid = bisect_left(A, X)
    l = len(A[:mid])
    r = len(A[mid:])
    print((min(l, r)))

def __starting_point():
    main()

__starting_point()


n, m, x = map(int, input().split())

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

r = 0
for i in range(x+1,n):
    for j in range(m):
        if i == a[j]:
            r += 1

l = 0
for i in range(x-1, -1, -1):
    for j in range(m):
        if i == a[j]:
            l += 1

print(min(l,r))


# 入力
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

goto_goal_0 = 0 # 0までのコスト
goto_goal_n = 0 # nまでのコスト

# x から 0 へ向かうコストを計算
for i in range(x - 1, 0, -1):   # x-1 番目から順番にデクリメントしながらforループ
    if i in a:
        goto_goal_0 += 1
        # print("0 is {}".format(goto_goal_0))

# x から n へ向かうコストを計算
for i in range(x, n + 1):   # x 番目から順番にインクリメントしながらforループ
    if i in a:
        goto_goal_n += 1
        # print("n is {}".format(goto_goal_n))

if goto_goal_0 < goto_goal_n:
    print(goto_goal_0)
else:
    print(goto_goal_n)


N, M, X = map(int, input().split())
A = sum(int(i) < X for i in input().split())
print(min(A, M - A))


import numpy as np

n, m, x = map(int, input().split())
a = list(map(int, input().split()))

a = np.array(a)

ans = min(len(a[a<x]), len(a[a>x]))
print(ans)


n,m,x = map(int,input().split())
a = list(map(int,input().split()))
i = 0
j = 0
for k in a:
    if k>x:
        i += 1
    elif k<x:
        j += 1
print(min(i,j))


n, m, x = map(int, input().split())
a = [int(s) for s in input().split()]

for i in range(m):
    if a[i] > x:
        less = len(a[:i])
        more = len(a[i:])
        print(min(less, more))
        break


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

goal_N = 0
goal_0 = 0

for i in range(X, N + 1):
    if i in A:
        goal_N += 1

for i in range(0, X + 1):
    if i in A:
        goal_0 += 1

min_cost = min(goal_N,goal_0)

print(min_cost)


N, M, X = map(int, input().split())
A = [*map(int, input().split())]
l = [i < X for i in A]
r = [i > X for i in A]
print(l.count(False) if l.count(False) < r.count(False) else r.count(False))


n, m, x = list(map(int, input().split()))
am = list(map(int, input().split()))

class Solution:
    def __init__(self, n, m, x, am):
        self.n = n
        self.m = m
        self.x = x
        self.am = am

    def __make_list(self):
        list_n = [0] * n
        for i in self.am:
            list_n[i - 1] = 1
        return list_n

    def answer(self):
        list_n = self.__make_list()
        print((min(sum(list_n[:self.x - 1]), sum(list_n[x - 1:]))))

conditions = Solution(n, m, x, am)
conditions.answer()


n,m,x = map(int,input().split())
a = [int(s) for s in input().split()]
cost = []
count = 0

for i in range(x,n):
    if a.count(i) == 1:
        count += 1
cost.append(count)
count = 0
c = range(0,x)
for i in reversed(c):
    if a.count(i) == 1:
        count += 1
cost.append(count)
print(min(cost))


n,m,x=map(int, input().split())
a=list(map(int, input().split()))
mas=[0]*(n+1)
for i in a:
    mas[i]=1
print(min(sum(mas[0:x]),sum(mas[x:n+1])))


n, m, x = input().split()
list01 = input().split()
list02 = [int(a) for a in list01]
b = sum(c > int(x) for c in list02)
d = sum(e < int(x) for e in list02)
print(min(b, d))


N,M,X=list(map(int,input().split()))
A=list(map(int,input().split()))
sum1=0
sum2=0
for i in range(M):
    if A[i]<X:
        sum1+=1
    else:
        sum2+=1
print((min(sum1,sum2)))


import sys
n,m,x=map(int,input().split())
a=list(map(int,input().split()))

s=0
b=0
for i in a:
    if i<x:
        s+=1
    if i>x:
        b+=1
print(min(s,b))


from bisect import bisect_left
n, m, x, *a = list(map(int, open(0).read().split()))

b = bisect_left(a, x)
print((min(m - b, b)))


n,m,x = map(int,input().split())
lst = list(map(int, input().split()))

a_cost = 0
b_cost = 0
for i in lst:
    if i > x:
        a_cost += 1
    else:
        b_cost += 1
print(min(a_cost, b_cost))


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

goal_N = 0
goal_0 = 0

for i in range(X, N + 1):
    if i in A:
        goal_N += 1

for i in range(0, X + 1):
    if i in A:
        goal_0 += 1

min_cost = min(goal_N,goal_0)

print(min_cost)


n, m, x = map(int, input().split())

back = 0
for a in map(int, input().split()):
    if a < x:
        back += 1
else:
    print(min(back, m - back))


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

l_cost = 0
g_cost = 0

for i in A:
    if i > X:
      l_cost += 1
    else:
        g_cost += 1

print(min(l_cost, g_cost))


_, m, x = map(int, input().split())

back = 0
for a in map(int, input().split()):
    if a < x:
        back += 1
else:
    print(min(back, m - back))


N,M,X=list(map(int,input().split()))
A=list(map(int,list(input().split())))
countA=0
countB=0
for i in A:
    if i>X:
        countA+=1
    if i<X:
        countB+=1
if countA<countB:
    print(countA)
else:
    print(countB)


N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
right = 0
left = 0

for a in A:
    if X > a:
        right += 1
    elif X < a:
        left += 1

print((min(right, left)))


n,m,x = map(int,input().split())
a = list(map(int,input().split()))

# 小さいほうの料金所の数
small_cost = 0
# 大きい方の料金所の数
big_cost = 0

# リストaの値とｘを比較して
for i in a:
    # ｘより小さいものをカウント
    if x > i:
        small_cost += 1
    # ｘより大きいものをカウント
    elif x < i:
        big_cost += 1
# 少ない方のカウントを出力
if small_cost <= big_cost:
    print(small_cost)
else:
    print(big_cost)


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

cost_ToZero = cost_ToEnd = 0

for cost_mass in cost_masses:
    if X < cost_mass:
        cost_ToEnd = cost_ToEnd + 1
    elif X > cost_mass:
        cost_ToZero = cost_ToZero + 1
else:
  print(min([cost_ToZero, cost_ToEnd]))


n, m, x = map(int,input().split())
l = 0
a = list(map(int,input().split()))
for j in a:
    l += 1 if j > x else 0
print(min(l,m-l))


# -*- coding:utf-8 -*-
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))

A.append(X)
A.sort()

A_index = A.index(X)

len_bef = len(A[0:A_index])
len_aft = len(A[A_index+1:])
ans = len_bef

if len_bef > len_aft:
    ans = len_aft

print(ans)


N, M, X = map(int, input().split())
A = list(map(int, input().split()))
l1 = []
l2 = []

for i in A:
    if X > i:
        l1.append(i)
    else:
        l2.append(i)

print(min(len(l1), len(l2)))


def mapt(fn, *args):
    return tuple(map(fn, *args))

def Input():
    return mapt(int, input().split(" "))

def main():
    n, m, x = Input()
    a = [0] * n
    for i in Input():
        a[i-1] = 1

    print(min(sum(a[:x]), sum(a[x-1:])))

main()


n,m,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0

for i in range(m):
    if a[i] > x:
        if i < m-i: ans = i
        else      : ans = m-i
        break
print(ans)


#!/usr/bin/env python3

def main():
    n, m, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    for i in range(m):
        if a[i] > x:
            ans = min(i, len(a) - i)
            break
    else:
        ans = 0
    print(ans)

def __starting_point():
    main()

__starting_point()


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

for i , a in enumerate(A):
    if X < a:
        break

if i > len(A) / 2:
    ans = len(A[i:])
else:
    ans = len(A[:i])

print(ans)


n,m,x = map(int,input().split())
a = list(map(int,input().split()))
data = [0]*(n + 1)
cost_1 = 0
cost_2 = 0
for i in range(m):
    data[a[i]] = 1
for i in range(0,x):
    cost_1 += data[i]
for j in range(x,n):
    cost_2 += data[j]
print(min(cost_1,cost_2))


# 全体のマスを開始位置でスライス、料金所だけ抽出し、要素の個数で条件分岐
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

square = list(range(0, N + 1))

a = square[:X + 1]
b = square[X:]

a_costs = []
b_costs = []

for i in a:
    if i in A:
        a_costs.append(i)
for i in b:
    if i in A:
        b_costs.append(i)

a_cost = len(a_costs)
b_cost = len(b_costs)

if a_cost > b_cost:
    print(b_cost)
else:
    print(a_cost)


n,m,x = map(int,input().split())
a = list(map(int,input().split()))
a.append(x)
a = sorted(a)
print(len(a[:a.index(x)]) if len(a[:a.index(x)+1]) <= len(a[a.index(x)+1:]) else len(a[a.index(x)+1:]))


n,m,x = map(int,input().split())
li = list(map(int,input().split()))
cnt = 0
cou = 0
for i in range(x):
    if i in li:
        cnt += 1
for i in range(x,n):
    if i in li:
        cou += 1
print(min(cnt,cou))


n,m,s = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

low = 0
high = 0
for i in range(m):
  if a[i] < s:
    low += 1
  else:
    high += 1
print(min(low,high))


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

zero_goal = 0
N_goal = 0

for i in A:
    if i < X:
        zero_goal = zero_goal + 1
    else:
        N_goal = N_goal + 1
print((min(zero_goal, N_goal)))


n, m, x = list(map(int, input().split()))
am = list(map(int, input().split()))
list_n = [0] * n
for i in am:
    list_n[i - 1] = 1
print((min(sum(list_n[:x - 1]), sum(list_n[x - 1:]))))


n, m, x = list(map(int, input().split()))
a = list(map(int, input(). split()))

goto_goal_0 = 0
goto_goal_n = 0

for i in range(x, 0, -1):
    if i in a:
        goto_goal_0 += 1

for i in range(x, n + 1, 1):
    if i in a:
        goto_goal_n += 1

if goto_goal_0 < goto_goal_n:
    print(goto_goal_0)
else:
    print(goto_goal_n)


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

cost_0 = 0
cost_last = 0

for n in A:
  if n > X:
    cost_last += 1
  elif n < X:
    cost_0 += 1

if cost_0 >= cost_last:
  print(cost_last)
elif cost_0 < cost_last:
  print(cost_0)


n,m,x = list(map(int,input().split()))
l = [0]*n
a = list(map(int,input().split()))
for i in a:
    l[i-1] = 1

left = sum(l[:x])
right = sum(l[x-1:len(l)])

print((left if left<=right else right))


n,m,x = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
ans = min(sum(1 for i in a if i > x),sum(1 for i in a if i < x))
print(ans)


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

A.sort()

import bisect
idx = bisect.bisect(A, X)

ans_r = len(A[idx:])
ans_l = len(A[:idx])

ans = min(ans_l, ans_r)
print(ans)


n, m, x = list(map(int, input().split()))
squares = list(map(int, input().split()))

left_cost = 0
right_cost = 0
for square in squares:
    if square < x:
        left_cost = left_cost + 1
    else:
        right_cost = right_cost + 1

print((min(right_cost, left_cost)))


n, m, x = map(int, input().split())
a_l = list(map(int, input().split()))

for i, a in enumerate(a_l):
    if x < a:
        break
if i > len(a_l)/2:
    ans = len(a_l[i:])
else:
    ans = len(a_l[:i])
print(ans)


n, m, x = list(map(int, input().split()))
arr = list(map(int, input().split()))

mn = 0
l_cost = 0
r_cost = 0

# Calculate left cost
for i in range(x):
    if i in arr:
        l_cost += 1

# Calculate right cost
for i in range(x, n + 1):
    if i in arr:
        r_cost += 1

print((min(l_cost, r_cost)))


n,m,x=map(int,input().split())
a=list(map(int,input().split()))
k=[0]*(n+1)
for i in a:k[i]=1
print(min(sum(k[0:x+1]),sum(k[x:n+1])))


N = list(input())
if N[0] == N[1] and N[0] == N[2]:
    print('Yes')
elif N[1] == N[2] and N[2] == N[3]:
    print('Yes')
else:
    print('No')


# 079a

def atc_079a(input_value: str) -> str:
    n = 3
    for i in range(0, len(input_value) + 1 - n):
        for j in range(1, n):
            if input_value[i] != input_value[i + j]:
                break
            if j == n - 1:
                return "Yes"
    return "No"

input_value = input()
print((atc_079a(input_value)))


N = input()

data_list = str(N)

if data_list[0] == data_list[1] == data_list[2]:
    print('Yes')
elif data_list[1] == data_list[2] == data_list[3]:
    print('Yes')
elif data_list[0] == data_list[1] == data_list[2] == data_list[3]:
    print('Yes')
else:
    print('No')


N = input()

if N[0] == N[1] and N[1] == N[2]:
    print("Yes")
elif N[1] == N[2] and N[2] == N[3]:
    print("Yes")
else:
    print("No")


N = str(input())

if N[0] == N[1] == N[2]:
    print('Yes')
elif N[1] == N[2] == N[3]:
    print('Yes')
else:
    print('No')


n = input()
cnt = 1
for i in range(len(n)-1):
  if n[i] == n[i+1]:
    cnt += 1
  else:
    cnt = 1
  if cnt >= 3:
    print("Yes")
    return

print('No')


N = input()
check = False
for i in range(2):
  if N[i:i+3] == N[i] * 3:
    check = True

print("Yes" if check else "No")


a,b,c,d = input()
if (a==b==c) or (b==c==d):
	print("Yes")
else:
	print("No")


N = str(input())
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
    result = 'Yes'
else:
    result = 'No'

print(result)


N = input()
answer = list(N)

if answer[0] == answer[1] == answer[2]:
    print("Yes")
elif answer[1] == answer[2] == answer[3]:
    print("Yes")
else:
    print("No")


N = str(input())

if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
    result = "Yes"
else:
    result = "No"

print(result)


#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n = str(int(input()))

flag = False
if n[0] == n[1] and n[1] == n[2]:
    flag = True
if n[1] == n[2] and n[3] == n[2]:
    flag = True

if flag:
    print("Yes")
else:
    print("No")


# A - Good Integer
# https://atcoder.jp/contests/abc079/tasks/abc079_a

s = input()

if len(set(s[:3])) == 1 or len(set(s[1:])) == 1:
    print('Yes')
else:
    print('No')


N=input()
#Nのi文字目とi＋1文字目が同じであればカウントを増やす。
j_count=0
for i in range(0,3):
    if N[i]==N[i+1]:
        j_count+=1
if j_count>=2 and N[1]==N[2]:
    print("Yes")
else:
    print("No")


N = input()
s1 = N[1:len(N)]
s2 = N[0:len(N) - 1]
isOk = True
for i in range(1, len(N)-1):
    if s1[i] != s1[i - 1]:
        isOk = False
        break
    else:
        continue

if isOk:
    print('Yes')
    return

isOk = True
for i in range(1, len(N)-1):
    if s2[i] != s2[i - 1]:
        isOk = False
        break
    else:
        continue

if isOk:
    print('Yes')
else:
    print('No')


n = list(input())
list01 = list(set(n[0:3]))
list02 = list(set(n[1:4]))
if len(list01) == 1 or len(list02) == 1:
    print('Yes')
else:
    print('No')


N = list(map(str, input()))
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3] :
    print('Yes')
else:
    print('No')


def main():
    x = input()

    if len(set(x[:3])) == 1 or len(set(x[1:])) == 1:
        print("Yes")
    else:
        print("No")

main()


numbers = input()

if numbers[1] == numbers[2]:
    if numbers.count(numbers[1]) >= 3:
        print("Yes")
        return

print("No")


N = input()
if N[1] == N[2]:
    if N[0] == N[1] or N[2] == N[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    # 1 line 1 int
    return int(sys.stdin.readline().rstrip())
def LI():
    # 1 line n ints
    return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    # 1 line 1 string
    return sys.stdin.readline().rstrip()
def LS():
    # 1 line n strings
    return list(sys.stdin.readline().rstrip().split())

A = S()

if A[0] == A[1] == A[2] or A[1] == A[2] == A[3]:
   print("Yes")
else:
   print("No")


def atc_079a(input_value: str) -> str:
    n = 3
    for i in range(0, len(input_value) + 1 - n):
        for j in range(1, n):
            if input_value[i] != input_value[i + j]:
                break
            if j == n - 1:
                return "Yes"
    return "No"

input_value = input()
print(atc_079a(input_value))


def iroha():
    num = list(input())
    count = 0
    head = num[0]

    for i, char in enumerate(num):
        if head == num[i]:
            count += 1
            if count >= 3:
                print('Yes')
                return
        else:
            count = 1
            head = num[i]

    print('No')

def __starting_point():
    iroha()

__starting_point()


li = list(input())

if li[0] == li[1] and li[1] == li[2]:
    print('Yes')
elif li[1] == li[2] and li[2] == li[3]:
    print('Yes')
elif li[0] == li[1] and li[0] == li[2] and li[0] == li[3]:
    print('Yes')
else:
    print('No')


s = input()
if len(set(s[:3])) == 1 or len(set(s[1:])) == 1:
    print("Yes")
else:
    print("No")


S = input()
if len(list(set(S[:-1]))) == 1 or len(list(set(S[1:]))) == 1:
    print("Yes")
else:
    print("No")


n=input()
if len(set(n[:3]))==1 or len(set(n[1:4]))==1:
    print("Yes")
else:
    print("No")


n=list(input())
if len(set(n[:3]))==1 or len(set(n[1:]))==1:
    print("Yes")
else:
    print("No")


a, b, c, d = input()
print('Yes' if a == b == c or b == c == d else 'No')


import sys
n = input()
cand = [str(i) + str(i) + str(i) for i in range(10)]
for ci in cand:
  if n.count(ci) >= 1:
    print("Yes")
    return
print("No")


n = input()

if n[0] == n[1] and n[1] == n[2]:
    print('Yes')
elif n[1] == n[2] and n[2] == n[3]:
    print('Yes')
else:
    print('No')


N = str(input())

if N[0] == N[1] and N[1] == N[2] :
    print('Yes')

elif N[1] == N[2] and N[2] == N[3]:
    print('Yes')

else:
    print('No')


#!/usr/bin/env python3

def main():
    a, b, c, d = input()
    print(("Yes" if a == b == c or b == c == d else "No"))

def __starting_point():
    main()

__starting_point()


N = input()
good_ints = (str(i) * 3 for i in range(9 + 1))
answer = ''

for good_int in good_ints:
    if good_int in N:
        answer = 'Yes'
        break

print(answer if answer else 'No')


# 4桁の数字で3つ以上連続するか判定

N = list(input())
# print(N)

if N[0] == N[1] and N[0] == N[2]:
    print('Yes')
elif N[1] == N[2] and N[1] == N[3]:
    print('Yes')
else:
    print('No')


N=input()
j_count=0
for i in range(0,3):
    if N[i]==N[i+1]:
        j_count+=1
if j_count>=2 and N[1]==N[2]:
    print("Yes")
else:
    print("No")


integer = input()
if integer[0] == integer[1] == integer[2] or integer[1] == integer[2] == integer[3]:
    print('Yes')
else:
    print('No')


#
# abc079 a
#
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1118"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7777"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1234"""
        output = """No"""
        self.assertIO(input, output)

def resolve():
    N = input()

    if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
        print("Yes")
    else:
        print("No")

def __starting_point():
    # unittest.main()
    resolve()

__starting_point()


N = input()
for i in range(10):
    if N.count(str(i)*3):
        print('Yes')
        return
print('No')


a,b,c,d=input()
print(("Yes" if a==b==c or b==c==d else "No"))


N = input()

o1 = set(N[0:3])
o2 = set(N[1:])
o3 = set(N)

print("Yes" if len(o1) == 1 or len(o2) == 1 or len(o3) == 1 else "No")


# 数値の取得
N = str(input())

# 数値の検証
f_cnt = (N[:3]).count(N[:1])
l_cnt = (N[1:]).count(N[3:])
if f_cnt == 3\
or l_cnt == 3:
    print("Yes")
else:
    print("No")


import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    #1 line 1 int
     return int(sys.stdin.readline().rstrip())
def LI():
    #1 line n int
     return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    #1 line 1 string
     return sys.stdin.readline().rstrip()
def LS():
    #1 line n strings
     return list(sys.stdin.readline().rstrip().split())

A=S()

if A[0] == A[1] == A[2] or A[1] == A[2] == A[3]:
    print("Yes")
else:
    print("No")


a, b, c, d = input()
print("Yes" if a==b==c or b==c==d else "No")


S = input()
ans = False
for i in range(len(S)):
  if S[1] == S[2] == S[3] or S[0] == S[1] == S[2]:
    ans = True
if ans:
  print("Yes")
else:
  print("No")


n = input().rstrip()
print(['No', 'Yes'][int(len(set(n[:3])) == 1 or len(set(n[1:])) == 1)])


n = input()
if n[1] == n[2]:
    if n[0]==n[1] or n[2]==n[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


# A - Good Integer
#  標準入力N

N = input()
my_list = []
j = 0

for i in N:
    my_list.append(i)

if my_list[0] == my_list[1] == my_list[2] or my_list[1] == my_list[2] == my_list[3]:
    print('Yes')
else:
    print('No')


n = input()
arr = []
for i in range(10):
    s = ""
    for j in range(3):
        s += str(i)
    arr.append(s)

if n[0:3] in arr or n[1:4] in arr:
    print("Yes")
else:
    print("No")


'''
問題：
    1118 のような、3 つ以上の同じ数字が連続して並んだ
    4 桁の整数を 良い整数 とします。

    4 桁の整数N が与えられるので、N が 良い整数 かどうかを答えてください。
'''

'''
制約：
    1000 ≦ N ≦ 9999
    入力は整数からなる
'''

# 標準入力から N を取得する
n = int(input())
list_n = list(str(n))

result = ""

if (list_n[0] == list_n[1]) and (list_n[1] == list_n[2]):
    result = "Yes"
elif (list_n[1] == list_n[2]) and (list_n[2] == list_n[3]):
    result = "Yes"
else:
    result = "No"

print(result)


n = int(input())
n = str(n)
# nの二桁目と三桁目が同じで、それが一桁目か四桁目がと同じならYes
if n[1] == n[2]:
    if n[0] == n[1] or n[2] == n[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


N = input()
good_ints = (str(i) * 3 for i in range(9 + 1))

for good_int in good_ints:
    if good_int in N:
        print('Yes')
        return

print('No')


N = input()

# 3つ以上の同じ数字が連続して並んだ 4桁の整数を 良い整数 とします。
# N が良い整数 ならば Yes を、そうでなければ No を出力せよ。

if N[1] == N[2]:
    if N[0] == N[1] or N[2] == N[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


# coding = SJIS

n = str(input())

if n[0] == n[1] and n[1] == n[2]:
    print("Yes")
elif n[1] == n[2] and n[2] == n[3]:
    print("Yes")
else:
    print("No")


N = input()

for i in range(2):
   if N[i:i+3] == 3 * N[i]:
      print('Yes')
      return

print('No')


a=input()
b=set(a[:-1]);c=set(a[1:])

if len(b)==1 or len(c)==1:
  print('Yes')
else:
  print('No')


import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    #1 line 1 int
     return int(sys.stdin.readline().rstrip())
def LI():
    #1 line n int
     return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    #1 line 1 string
     return sys.stdin.readline().rstrip()
def LS():
    #1 line n strings
     return list(sys.stdin.readline().rstrip().split())

xs=LI()

if xs[0] == xs[1]:
    print(xs[2])
elif xs[0] == xs[2]:
    print(xs[1])
else:
    print(xs[0])


A, B, C = map(int,input().split())

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)


a = input().split(' ')

for i in a:
    if (a.count(i)==1):
        print(i)


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

if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


#
# abc075 a
#
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 7 5"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1 1 7"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """-100 100 100"""
        output = """-100"""
        self.assertIO(input, output)

def resolve():
    A, B, C = list(map(int, input().split()))

    if A == B:
        print(C)
    elif A == C:
        print(B)
    else:
        print(A)

def __starting_point():
    # unittest.main()
    resolve()

__starting_point()


#75
a,b,c=map(int,input().split())
if a==b:
    print(c)
elif a==c:
    print(b)
else:
    print(a)


a, b, c = input().split()
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


a,b,c=map(int, input().split())
print(a if b==c else b if c==a else c)


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

for i in b:
  if (a.count(i))==1:
    print(i)


# 3つの整数のうち1つだけ異なる値を出力
A, B, C = map(int,input().split())

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)


import collections
l=list(map(int,input().split()))
counted = collections.Counter(l)
print(counted.most_common()[1][0])


l=list(map(int,input().split()))
from collections import Counter
l=list(Counter(l).most_common())
print(l[1][0])


a,b,c = input().split()
if a == b:
    print(c)
elif a == c:
    print(b)
elif b == c:
    print(a)


A,B,C=map(int,input().split())
if A==B :
  print(C)
elif B==C :
  print(A)
else :
  print(B)


a,b,c=map(int,input().split())
if a==b:
  print(c)
elif b==c:
  print(a)
else:
  print(b)


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

if a == b:
  print(c)

elif a == c:
  print(b)

else:
  print(a)


A, B, C = [int(i) for i in input().split()]

if A == B:
  print(C)
elif A == C:
  print(B)
elif B == C:
  print(A)


a,b,c = map(int,input().split())
print(a if b==c else b if a==c else c)


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


A,B,C = map(int,input().split())

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)


a, b, c = list(map(int, input().split()))
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


a,b,c = map(int, input().split())
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


A,B,C = map(int,input().split())

print(A if B == C else B if A == C else C)


A, B, C = sorted(map(int, input().split()))

print((A if B == C else C))


a,b,c=map(int,input().split())
if a==b:
  print(c)
elif a==c:
  print(b)
else:
  print(a)


A, B, C = list(map(int, input().split()))

if A - B == 0:
    print(C)
elif A - C == 0:
    print(B)
else:
    print(A)


a, b, c = map(int, input().split())
if a == b: print(c)
if b == c: print(a)
if c == a: print(b)


A, B, C = map(int, input().split())

if A == C:
    print(B)
elif B == C:
    print(A)
else:
    print(C)


a,b,c = map(int,input().split())
if a != b and a == c:
    print(b)
elif a != b and a != c:
    print(a)
else:
    print(c)


def main():
  a = list(map(int,input().split()))
  if a[0] == a[1]:
    print((a[2]))
  elif a[1] == a[2]:
    print((a[0]))
  else:
    print((a[1]))

def __starting_point():
  main()

__starting_point()


integer1, integer2, integer3 = map(int, input().split())
if integer2 == integer3:
    print(integer1)
elif integer1 == integer3:
    print(integer2)
else:
    print(integer3)


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

print(c) if a == b else print(b) if a == c else print(a)


# A - One out of Three
# https://atcoder.jp/contests/abc075/tasks/abc075_a

A, B, C = list(map(int, input().split()))

if A == B and A != C:
    print(C)
elif A == C and A != B:
    print(B)
elif B == C and A != C:
    print(A)


A,B,C = map(int, input().split())
if A == C:
   print(B)
elif A == B:
    print(C)
else:
    print(A)


# 入力
A, B, C = map(int, input().split())

# 比較して出力
if A == B:
    print(C)
elif A == C:
    print(B)
elif B == C:
    print(A)


# 入力
A, B, C = map(int,input().split())

# 処理
if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)


x,y,z=map(int,input().split())
print(z if x == y else y if x == z else x)


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

if a == c:
	print(b)
elif a == b:
	print(c)
elif b == c:
	print(a)


a,b,c = map(int,input().split())
if a == b:
    print(c)
if a == c:
    print(b)
if b == c:
    print(a)


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

if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


a = [int(x) for x in input().split()]
if a[0] == a[1]:
  print(a[2])
elif a[1] == a[2]:
  print(a[0])
else:
  print(a[1])


a,b,c = map(int,input().split())
if a==b:
    print(c)
elif a==c:
    print(b)
else:
    print(a)


A, B, C = map(int, input().split())

if A == B:
  print(C)
elif B == C:
  print(A)
else:
  print(B)


a,b,c=list(map(int,input().split()))
if a==b & b != c:
    print(c)
elif a==c & c !=b:
    print(b)
else:
    print(a)


A, B, C = map(int, input().split())

if A == B:
    print(C)
elif B == C:
    print(A)
elif C == A:
    print(B)


A, B, C = map(int, input().split())

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)


a, b, c = map(int, input().split())
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


a,b,c = map(int, input().split())
if a==b:
  print(c)
elif a==c:
  print(b)
else:
  print(a)


import sys, collections
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    ABC = LI()

    cnt = collections.Counter(ABC)
    ans = [k for k, v in list(cnt.items()) if v == 1]
    print((ans[0]))

def __starting_point():
    resolve()

__starting_point()


# 3 つの整数 A, B, Cが与えられます。
# A, B, C のうち 2つは 同じ整数であり、
# 残りの 1つだけ異なる整数です。
# 例えば、A = 5, B = 7, C = 5の場合、
# A, C の 2つは同じ整数であり、
# B は 1つだけ異なる整数です。
# 3つの整数のうち、1つだけ異なる整数を求めてください。

# 制約
# -100 ≦ A, B, C ≦ 100
# A, B, C は整数
# 入力は問題文の条件を満たす

# 標準入力から A, B, C の値を取得する
a, b, c = list(map(int, input().split()))

# 異なる整数を探して出力する
result = 0

if a == b:
    result = c
elif b == c:
    result = a
elif a == c:
    result = b
else:
    result = "Error"

print(result)


a, b, c = map(int, input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)


a,b,c = input().split()

if(a==b):
    print(c)
elif(a == c):
    print(b)
else:
    print(a)


from collections import Counter

ABC = list(map(int, input().split()))

cnt = Counter(ABC)
values, counts = zip(*cnt.most_common(2))

print(values[1])


num = list(map(int, input().split()))
num = sorted(num)
print((num[0] if num[0] != num[1] else num[2]))


a,b,c = map(int,input().split())
if a==b:
    print(c)
elif b==c:
    print(a)
else:
    print(b)


a,b,c = map(int,input().split())
if a == c:
  print(b)
elif a == b:
  print(c)
else:
  print(a)


def mapt(fn, *args):
    return tuple(map(fn, *args))

def Input():
    return mapt(int, input().split(" "))

def main():
    abc = sorted(Input())
    if abc[0] == abc[1]:
        print(abc[2])
    else:
        print(abc[0])

main()


a,b,c=input().split()
if a==b:
    print(c)
elif a==c:
    print(b)
else:
    print(a)


# A - One out of Three

# 入力された整数A,B,Cのうち、2つは等しく1つは異なる
# 1つだけ異なる整数の値を出力する

A,B,C = list(map(int,input().split()))

if A == B:
    print(C)
elif A == C:
    print(B)
elif B == C:
    print(A)


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

if a==b:
    print(c)
elif b ==c:
    print(a)
else:
    print(b)


# 3 つの整数 A , B , C が与えられます。 A , B , C のうち 2 つは 同じ整数であり、残りの 1 つだけ異なる整数です。
# 例えば、 A = 5 , B = 7 , C = 5 の場合、 A , C の 2 つは同じ整数であり、 B は 1 つだけ異なる整数です。
# 3 つの整数のうち、 1 つだけ異なる整数を求めてください。

A,B,C =map(int,input().split())

if A == B:
    print(C)

elif A == C:
    print(B)

elif B == C:
    print(A)


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

if a == b:
  print(c)
elif a == c:
  print(b)
else:
  print(a)


A,B,C=list(map(int,input().split()))
if A==B:
    print(C)
elif B==C:
    print(A)
else:
    print(B)


#!/usr/bin/env python3

A, B, C = list(map(int, input().split()))
if A == B: print(C)
elif A == C: print(B)
else: print(A)


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

print((a ^ b ^ c))


A, B, C = map(int, input().split())
print(A if B == C else B if A == C else C)


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

if int(a) == int(b):
  print(c)
if int(a) == int(c):
  print(b)
if int(b) == int(c):
  print(a)


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return list(map(int, input().split()))
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print(('\n'.join(x)))
    def printni(x): print(('\n'.join(list(map(str,x)))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    a,b,c=MI()
    if a==b:
        print(c)
    elif b==c:
        print(a)
    else:
        print(b)

def __starting_point():
    main()

__starting_point()


lst = input().split()

for i in range(3):
   if lst.count(lst[i]) == 1:
      print(lst[i])
      break


A,B,C=list(map(int,input().split()))
if A==B:
  print(C)
elif A==C:
  print(B)
elif B==C:
  print(A)


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

if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)


A, B, C = map(int, input().split())
print(A ^ B ^ C)


#   AtCoder abc075 a
#   ストレッチ課題

#   入力
a, b, c =list(map(int, input().split()))

#   判定
if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)


A, B, C = map(int, input().split())

if A == B:
    print(C)
elif B == C:
    print(A)
elif A == C:
    print(B)


A,B,C = list(map(int,input().split()))
if A==B:
    print(C)
elif A == C:
    print(B)
elif B == C:
    print(A)


A, B, C = map(int, input().split())

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)


a,b,c = sorted(map(int,input().split()))
print( c if a == b else a)


a,b,c=map(int,input().split())
if a==c:
    print(b)
elif a==b:
    print(c)
else:
    print(a)


l = list(map(int, input().split()))
for ll in l:
    if l.count(ll)==1:
        print(ll)
        break


def iroha():
    a,b,c = list(map(int, input().split()))
    if a == b:
        print(c)
    elif a == c:
        print(b)
    else:
        print(a)

def __starting_point():
    iroha()

__starting_point()


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

if a==b:
    ans=c
elif b==c:
    ans=a
else:
    ans=b
print(ans)


a, b, c = map(int, input().split())
if a == b:
    print(c)
elif c == b:
    print(a)
else:
    print(b)


# 075_a
A,B,C=list(map(int,input().split()))
if (-100<=A and A<=100) and (-100<=B and B<=100) and (-100<=C and C<=100):
    if A==B:
        print(C)
    elif B==C:
        print(A)
    elif C==A:
        print(B)


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

if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)


a,b,c=map(int,input().split())
print(a if b==c else b if a==c else c)


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

if a[0]==a[1]:
  print(a[2])
else:
  print(a[0])


a, b, c=map(int,input().split())
if a==b:
  print(c)
elif c==b:
  print(a)
else:
  print(b)