Harryxun/stf_run huggingface dataset:
#13:27
N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):#0-7
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1
n = 0
for i in range(N):
    if 3200 <= A[i]:
        n += 1
not_red_color = 0
c = 0
for i in range(8):
    if ex_red[i] > 0:
        c += 1
#print(c)#soreigai_count
#print(n)#red_count

max_ans = min(n + c)

#min_ans
if c >= 1:
    min_ans = c
elif c == 0:
    min_ans = 1
print(min_ans, max_ans)






    


### FIXED CODE ###

#13:27
N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):#0-7
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1
n = 0
for i in range(N):
    if 3200 <= A[i]:
        n += 1
not_red_color = 0
c = 0
for i in range(8):
    if ex_red[i] > 0:
        c += 1
#print(c)#soreigai_count
#print(n)#red_count

max_ans = n + c

#min_ans
if c >= 1:
    min_ans = c
elif c == 0:
    min_ans = 1
print(min_ans, max_ans)
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    s = input()
    k = int(input())
    n = 0
    while n<=k:
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    s = input()
    k = int(input())
    n = 0
    while n<=k-1:
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
n, t = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key = lambda x:x[1])
dp = [[0 for j in range(t+1)] for i in range(n+1)]

for i in range(n):
    for j in range(t):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    for j in range(t):
        if j < t:
            next = min(j + ab[i][0], t)
            dp[i+1] [next] = max(dp[i+1][next], dp[i][j] + ab[i][1])
print(max(dp[n][t]))


### FIXED CODE ###

import sys
input = sys.stdin.readline
n, t = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()

dp = [[0 for j in range(t+1)] for i in range(n+1)]

for i in range(n):
    for j in range(t+1):
        dp[i+1][j] =  dp[i][j]
    for j in range(t):
        next = min(j + ab[i][0], t)
        dp[i+1] [next] = max(dp[i+1][next], dp[i][j] + ab[i][1])
print(max(dp[n]))
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i：
      if T[i-1] == "P":
      	T[i] = "D"
    elif i < len(T) - 1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T) - 1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

### FIXED CODE ###

T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T)-1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T)-1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006) > abs(A - (T - H[n] * 0.006):
       n = i

print(n + 1)

### FIXED CODE ###

N = int(input())
T, A = input().split()
T = int(T)
A = int(A)
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006)) < abs(A - (T - H[n] * 0.006)):
       n = i

print(n + 1)
H, N = map(int, input().split())
A = input()

waza = 0
for i in range(0, N):
    waza = waza + int(A.split()[i])

if waza >= H:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

hp, attack = map(int, input().split())

x, y = divmod(hp, attack)

if y == 0:
	print(x)
else:
  	print(x + 1)
h,w=map(int,input().split())
x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1

def go_next(I,J):
    global dp,w,h
    if I<h-1:
        if x[I+1][J]==".":
            if dp[I+1][J]>dp[I][J]+1:
                dp[I+1][J]=dp[I][J]+1
                go_next(I+1,J)

    if I>0:
        if x[I-1][J]==".":
            if dp[I-1][J]>dp[I][J]+1:
                dp[I-1][J]=dp[I][J]+1
                go_next(I-1,J)
    if J<w-1:
        if x[I][J+1]==".":
            if dp[I][J+1]>dp[I][J]+1:
                dp[I][J+1]=dp[I][J]+1
                go_next(I,J+1)
    if J>0:
        if x[I][J-1]==".":
            if dp[I][J-1]>dp[I][J]+1:
                dp[I][J-1]=dp[I][J]+1
                go_next(I,J-1)
go_next(0,0)
print(c-dp[h-1][w-1])


### FIXED CODE ###

#一個だけRE、わからねえ
#解答見る
import sys
sys.setrecursionlimit(1005)
h,w=map(int,input().split())

def go_next(I,J,n):
    n+=1
    global dp,w,h
    if n>1000:
        return
    if 0<=I<h-1:
        if x[I+1][J]=="." and dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J,n)
    if 0<I<=h-1:
        if x[I-1][J]=="." and dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J,n)
    if 0<=J<w-1:
        if x[I][J+1]=="." and dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1,n)
    if 0<J<=w-1:
        if x[I][J-1]=="." and dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1,n)

x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1
go_next(0,0,0)
if dp[h-1][w-1]==10000000000:
    print(-1)
else:
    print(c-dp[h-1][w-1])
import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))
pN.sort()
key_index = bisect.bisect(pN, x) - 1
if n == 0:
    print(x)
else:
    while(1):
        if pN[key_index] - 1 != pN[key_index-1]:
            print(pN[key_index] - 1)
            break

        if pN[key_index] + 1 != pN[key_index+1]:
            print(pN[key_index] + 1)
            break
        key_index = key_index + 1

### FIXED CODE ###

import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))

pN.sort()

diff = 0

if n == 0:
    print(x)
else:
    while(1):
        if x-diff not in pN:
            print(x-diff)
            exit()
        elif x+diff not in pN:
            print(x+diff)
            exit()
        diff+=1
import sys
# input = sys.stdin.readline

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]


ans = 0
ans += B // C
ans -= (A - 1) // C
# print("#", ans)
ans += B // D
ans -= (A - 1) // D
# print("#", ans)
#
ans -= B // (C * D)
ans += (A - 1) // (C * D)
# print("#", ans)

ans = (B - A + 1) - ans
print(ans)

### FIXED CODE ###

import sys
# input = sys.stdin.readline

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

def div(a, b):
    return a // b

def gcd(a, b):
    if b > a: return gcd(b, a)
    elif b == 0: return a
    else: return gcd(b, a % b)

ans = 0
ans += div(B, C)
ans -= div(A - 1, C)
# print("#", ans)
ans += div(B, D)
ans -= div(A - 1, D)
# print("#", ans)
#
E = (C * D) // gcd(C, D)
ans -= div(B, E)
ans += div(A - 1, E)
# print("#", ans)

ans = (B - A + 1) - ans
print(ans)
import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()])
total = sum(al)

idx = bisect.bisect_left(al,total/(4*m))

if n - idx > m:
    print('Yes')
elif al[idx+1] == total/(4*m):
    print('No')
else:
    print('No')



### FIXED CODE ###

import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()],reverse = True)
total = sum(al)

l = al[:m]

if l[-1] >= total/(4*m):
    print('Yes')
else:
    print('No')
N,M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]
dekai = 1000000007
 
def Fib(n):
	a,b = 0,1
	if n == 1:
		return a
	elif n == 2:
		return b
	else:
		for i in range(n-2):
			a,b = b,a+b
		return b


ans = 1
for i in range(M+1):
	if i == 0:
		ans = ans*(Fib(a[0]-(-1))%dekai)
	elif i == M:
		ans = ans*(Fib(N+1-a[M-1])%dekai)
	else:
		ans = ans*(Fib(a[i]-a[i-1])%dekai
print(ans)

### FIXED CODE ###

N,M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]
dekai = 1000000007
"""
import sympy as sym

def Fib(n):
	x = sym.symbols('x',nonnegative=True,integer=True)
	Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1))
	result=Fib.subs(x,n)
	result=result.evalf(int(n*3/14)+1)
	return int(result)


"""
def Fib(n):
	a,b = 0,1
	if n == 1:
		return a
	elif n == 2:
		return b
	else:
		for i in range(n-2):
			a,b = b,a+b
		return b
ans = 1

if M == 0:
	print(Fib(N+1-(-1))%dekai)
	exit()

for i in range(M+1):
	if i == 0:
		ans = (ans*(Fib(a[0]-(-1))%dekai))%dekai
	elif i == M:
		ans = (ans*(Fib(N+1-a[M-1])%dekai))%dekai
	else:
		ans = (ans*(Fib(a[i]-a[i-1])%dekai))%dekai
print(ans)
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(n-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("yes")
else:
  print("no")


### FIXED CODE ###

n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(len(z)-2):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")
A,B = map(int, input().split())

print( (A+B)/2 if type((A+B)/2) =int else 'IMPOSSIBLE')

### FIXED CODE ###

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

print( (A+B)//2 if (A+B)%2 ==0 else 'IMPOSSIBLE')
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if x**2+y**2<=d**2:
  count+=1
print(count)

### FIXED CODE ###

import math
 
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if math.sqrt((x**2)+(y**2))<=d:
   count+=1
print(count)
IN=input().split(' ')
N=IN[0]
M=IN[1]
if (N==1 and M==1)or (N!=1 and M!=1):
    print((N-2)*(M-2))
else:
    print(N*M-2)


### FIXED CODE ###

im = []
im = input().split(' ')
N = int(im[0])
M = int(im[1])
if (N == 1 and M == 1) or (N != 1 and M != 1):
    print((N - 2) * (M - 2))
else:
    print(N * M - 2)
import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
#修正ver
X = [0] * N
for i in range(N):
    B = copy.copy(A)
    del B[i]
    max = max(B)
    X[i] = max
for i in range(N):
    print(X[i])


### FIXED CODE ###

import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
#修正ver
max_item = max(A)
count = 0
second_item = 0
for i in range(N):
    if A[i] == max_item:
        count += 1
    elif second_item < A[i]:
        second_item = A[i]
    if count > 1:
        break
X = [0] * N
judge = False
for i in range(N):
    if count > 1:
        judge = True
        break
    if A[i] == max_item:
        X[i] = second_item
    else:
        X[i] = max_item

if judge:
    for i in range(N):
        X[i] = max_item
for i in range(N):
    print(X[i])
#import math
A, B, H, M = [int(i) for i in input().split()]
h = H* 2*3.141592635/12 #rad
m = M* 2*3.1415926535/60 #rad
#print(h, "\n", m)
#def kyori(a,b,c,d):
#    return math.sqrt(a**2+b**2-2*a*b*math.cos(c-d))

print(math.sqrt(a**2+b**2-2*a*b*math.cos(c-d)))

### FIXED CODE ###

import math

def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d)))

A, B, H, M = [int(i) for i in input().split()]
m = M* 2*math.pi/60 #rad
h = H* 2*math.pi/12+ M*2*math.pi/60/12 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)
n = int(input())

for i in range(1, n+1):
 if i%3 == 0:
  ans += " " + str(i)
 elif i%10 == 3:
  ans += " " + str(i)
 div = i
 while div//10:
  div = div//10
  if div%10 == 3:
   ans += " " + str(div)
   div = 0
print(ans)

### FIXED CODE ###

n = int(input())
ans = ''
for i in range(1, n+1):
 if i%3 == 0:
  ans += " " + str(i)
 elif i%10 == 3:
  ans += " " + str(i)
 else:
  div = i
  while div//10:
   div = div//10
   if div%10 == 3:
    ans += " " + str(i)
    div = 0
print(ans)
N = int(input())
ans = 0

for i in range(N):
  A = int(input())
  ans += 1/A
  
ans = 1/ans

print(ans)
  

### FIXED CODE ###

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

for i in range(N):
  ans += 1/A[i]
  
ans = 1/ans
print(ans)
import random

D = int(input())
c = [int(i) for i in input().split()]
s = []
for _ in range(D):
    s.append([int(i) for i in input().split()])
score = 0
days = [[0]*26 for i in range(D+1)]
T = []
for k in range(D):
    t = int(input())-1
    T.append(t)
    for i in range(26):
        if i == t:
            days[k+1][i] = 0
        else:
            days[k+1][i] = days[k][i]+1
    score += s[k][t]
    for i in range(26):
        score -= days[k+1][i]*c[i]
for _ in range(10**5):
    d = random.randint(0, D-1)
    q = random.randint(0, 25)
    diff = s[d][q] - s[d][T[d]]
    i = d+1
    for k in range(d+1,D):
        if T[k] == q:
            i = k
            break
    else:
        i = D
    j = d+1
    for k in range(d+1,D):
        if T[k] == T[d]:
            j = k
            break
    else:
        j = D
    diff -= c[T[d]]*(days[d][T[d]]+1)*(j-d) - c[q]*days[d+1][q]*(i-d)
    if diff <= 0:
        continue
    score += diff
    L = days[d+1][q]
    for k in range(d+1,i+1):
        days[k][q]  -= L
    L = days[d][T[d]]+1
    for k in range(d+1,j+1):
        days[k][T[d]] += L
    T[d] = q
T = [str(i) for i in T]
print("\n".join(T))

### FIXED CODE ###

D = int(input())
c = [int(i) for i in input().split()]
days = [0]*26
ans = []
for k in range(D):
    s = [int(i) for i in input().split()]
    t = 0
    for i in range(1,26):
        if s[t] + days[t]*c[t] <= s[i] + days[i]*c[i]:
            t = i
    ans.append(t)
    for i in range(26):
        if i == t:
            days[i] = 0
        else:
            days[i] += 1
ans = [str(i+1) for i in ans]
print("\n".join(ans))
N,L,T=map(int,input().split())
X=[0 for i in range(N)]
W=[0 for i in range(N)]
for i in range(N):
    X[i],W[i]=map(int,input().split())
Y=[0 for i in range(N)]
for i in range(N):
    if W[i]==1:
        Y[i]=(X[i]+T)%L
    else:
        Y[i]=(X[i]-T)%L
def dist(i,j):
    if (3-2*W[i])*(3-2*W[j])==1:
        return -1
    else:
        if 3-2*W[i]==1:
            D=(X[j]-X[i])%L
            return D//2
        else:
            D=(X[i]-X[j])%L
            return D//2
z=0
dt=3-2*W[0]
for i in range(1,N):
    ds=3-2*W[i]
    if dt*ds==1:
        continue
    z+=dt*((T//L)*2)
    K=T%L
    if K>=dist(0,i):
        z+=dt
    if K>=dist(0,i)+L//2:
        z+=st
z=-z%N
Z=Y[z:]+Y[:z]
for i in range(N):
    print(Z[i])

    

### FIXED CODE ###

N,L,T=map(int,input().split())
X=[0 for i in range(N)]
W=[0 for i in range(N)]
D=0
for i in range(N):
    X[i],W[i]=map(int,input().split())
    W[i]=-2*W[i]+3
    D+=(X[i]+T*W[i])//L
D%=N
Y=sorted([((T*W[i])+X[i])%L for i in range(N)])
for i in range(N):
    print(Y[(D+i)%N])
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

for i in range(n):
    if i == 1:
        result = a[2:]
        print(max(result))
    elif i == n-1:
        result = a[:n-1]
        print(max(result))
    else:
        result = a[:i] + a[i+1:]
        print(max(result))

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_s = sorted(a, reverse=True)
hantei = a_s[:2]
del a_s
for i in range(n):
    if a[i] == hantei[0]:
        print(hantei[1])
    else:
        print(hantei[0])
import math
import random

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def is_prime3(q, k=50):
    q = abs(q)
    # 計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False

    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    # 判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        # [0,s-1]の範囲すべてをチェック
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True


a, b = map(int, input().split())
gcd = math.gcd(a, b)
divisors = make_divisors(gcd)

ans = 1
for divisor in divisors:
    if is_prime3(divisor):
        ans += 1

print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

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

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(b, a % b)


# https://en.wikipedia.org/wiki/Trial_division
def f(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1: a.append(n)
    # Only odd number is possible
    return a


c = gcd(A, B)

print(len(set(f(c))) + 1)
import math
x = int(input()+input())
y = math.sqrt(x)
if y == int(y):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
x0, x1 = input().split()
y = math.sqrt(int(x0+x1))
if y == int(y):
  print("Yes")
else:
  print("No")
N=int(input())
H=list(map(int, input().split()))
c=0
s=[H[i]-H[i+1] for i in range(N-1)]
for i in range(N-2):
  if H[i]-H[i+2]>1:
    c=1
if N==2 and (H[0]-H[1])>1:
  c=1
if max(s)>1:
  c=1
print('Yes' if c==0 else 'No')

### FIXED CODE ###

N=int(input())
H=list(map(int, input().split()))
for i in range(N-1):
  if H[N-i-2]-H[N-i-1]==1:
    H[N-i-2]-=1
  elif H[N-i-2]-H[N-i-1]>1:
    print('No')
    exit()
print('Yes')
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
ans=0 
s_list=list(s.split())
for j in range(q+1):
 ans+=int(s_list[j])
 
print(ans)

### FIXED CODE ###

n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[x]
 cnt[x]=0
 print(sum)
N, M, K = map(int, input().split())

DIV = 10**9+7

def comb(l, r):
    if l == 0:
        return 1
    val = 1
    for i in range(r, r-l, -1):
        val *= i
    for i in range(l, 0, -1):
        val //= i
    return val


#p = comb(K-2, N*M-2)
#print(K-2, N*M-2, p)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        #print(i, j, calc_rec_num(N, M, 0, 0, i, j))
        cnt = (N-i) * (M-j)
        if i != 0 and j != 0:
            cnt *= 2
        ans += d * cnt
        #if ans > DIV:
        #    ans %= DIV
        #print(ans)

print((ans*p)%DIV)


### FIXED CODE ###

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

ans = 0
if A <= 5:
    ans = 0
elif A >= 13:
    ans = B
else:
    ans = B//2

print(ans)
n = int(input())
s = input().split()
for i in range(n):
  s[i] = int(s[i])
memo = [0 for i in range(n+1)]
memo[0] = 0
memo[1] = 0
for i in range(2,n+1):
  memo[i] = min(memo[i-1]+abs(s[i]-s[i-1]), memo[i-2]+abs(s[i]-s[i-2]))
print(memo[n])

### FIXED CODE ###

n = int(input())
s = input().split()
for i in range(n):
  s[i] = int(s[i])
memo = [0 for i in range(n)]
memo[0] = 0
for i in range(1,n):
  if i==1:
      memo[i] = memo[i-1]+abs(s[i]-s[i-1])
  else:
      memo[i] = min(memo[i-1]+abs(s[i]-s[i-1]), memo[i-2]+abs(s[i]-s[i-2]))
print(memo[n-1])
a=int(input(a?))
b=int(input(b?))
if (a*b)%2 =0
print ('Even')
else:
  print ('Odd')

### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2 ==0:
  print('Even')
else:
  print('Odd')
s = list(input())
s1 = list(dropwhile(lambda x: x != 'A',s))
s2 = list(dropwhile(lambda x: x != 'Z',s1[::-1]))
print(len(s2))

### FIXED CODE ###

import itertools
s = list(input())
s1 = list(itertools.dropwhile(lambda x: x != 'A',s))
s2 = list(itertools.dropwhile(lambda x: x != 'Z',s1[::-1]))
print(len(s2))
n, m, x = map(int,input().split(' '))
a = [[] for i in range(n)]
e = [0] * m
sc = [0] * m
for i in range(n):
    l = list(map(int, input().split(' ')))
    l.append(l[0] / sum(l[1:]))
    a[i] = l
a.sort(key = lambda v : v[-1:])
p = 0
for i in a:
    p += i[0]
    for j in range(m):
        e[j] += i[j + 1]
        sc[j] = 1 if e[j] >= x else 0
    if sum(sc) == m:
        break
        
    
r = p if sum(sc) == m else -1
print(r)


### FIXED CODE ###

n, m, x = map(int,input().split(' '))
a = [[] for i in range(n)]
p = 0
for i in range(n):
    a[i] = list(map(int, input().split(' ')))
sc = 12 * 100001
for i in range(1, 2 ** n):
    bi = '0' * n + bin(i)[2:]
    bi = bi[len(bi) - n:]
    cc = 0
    e = [0] * m
    for j in range(n):
        if bi[j] == '1':
            for k in range(m):
                e[k] += a[j][k + 1]
            cc += a[j][0]
    su =True
    for j in range(m):
        su &= e[j] >= x
    if su:
        sc = min(sc, cc)
sc = -1 if sc > 12 * 100000 else sc
print(sc)
n=int(input)

for i in range(1,10):
    for j in range(i,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")

### FIXED CODE ###

n=int(input())

for i in range(1,10):
    for j in range(i,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

### FIXED CODE ###

S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT + 1):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))
N = int(input())
S = input()

def calculate(S):
    minVal = len(S)
    for index,value in enumerate(S):
        s1 = S[:index]
        s2 = S[index+1:]
        if value == "W":
            count1 = s1.count("W")
            count2 = s2.count("E")

        minVal = min(count1+count2,minVal)


    return minVal


value = calculate(S)

print(value)


### FIXED CODE ###

N = int(input())
S = input()


def calculate(S):
    SSS = []

    totalENum = S.count("E")

    for index, value in enumerate(S):
        if index == 0:
            obj = {}
            if value == "W":
                obj.__setitem__("W", 1)
                obj.__setitem__("E", 0)
            else:
                obj.__setitem__("E", 1)
                obj.__setitem__("W", 0)
            SSS.append(obj)
        else:
            obj = {}
            prevW = SSS[index - 1].__getitem__("W")
            prevE = SSS[index - 1].__getitem__("E")
            if value == "W":
                obj.__setitem__("W", prevW + 1)
                obj.__setitem__("E", prevE)
            else:
                obj.__setitem__("E", prevE + 1)
                obj.__setitem__("W", prevW)

            SSS.append(obj)

    resVal = len(S)
    for index,value in enumerate(S):
        if value == "W":
            resVal = min(resVal,SSS[index].__getitem__("W") - 1 + totalENum - SSS[index].__getitem__("E"))
        else:
            resVal = min(resVal, SSS[index].__getitem__("W") + totalENum - SSS[index].__getitem__("E"))

    return resVal


result = calculate(S)

print(result)