Harryxun/stf_run huggingface dataset:
N = int(input())
h = [int(i) for i in input().split()]
cost = [-1]*N
def jump_min(n):
    if n == 1:
        v = 0
    elif n == 2:
        v = abs(h[1]-h[0])
    else:
        x = jump_min(n-2)+abs(h[n-1]-h[n-3])
        y = jump_min(n-1)+abs(h[n-1]-h[n-2])
        v = min(x,y)
    return v
print(jump_min(N))


### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(1,n-1):
  dp[i+1]+=min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]))
print(dp[n-1])
A,B,K=map(int,input().split())

if K<A:
    ans1=A-K
else:
    ans1=0
    ans2=max(A+B-K,0)

print(ans1,ans2)

### FIXED CODE ###

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

if K<A:
    ans1=A-K
    ans2=B
else:
    ans1=0
    ans2=max(A+B-K,0)

print(ans1,ans2)
import numpy as np
N=int(input())
lista=[]
p=input().split()
for i in range(N):
  print(p[i])
  lista.append(p[i])
if np.prod(lista)<10**18:
  print(np.prod(lista))
else:
  print(-1)


### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)
n = input()
 
INF = 10000000
 
color = [0 for i in xrange(n)]
M = [[INF for i in xrange(n)] for i in xrange(n)]
d = [INF for i in xrange(n)]
p = [-1 for i in xrange(n)]
 
def m_s_t():
  d[0] = 0
 
   while True:
     cost = INF
     for i in xrange(n):
       if color[i] != 2 and d[i] < cost:
         cost = d[i]
         u = i
 
     if cost == INF:
        break
     
    color[u] = 2
 
   for v in xrange(n):
      if color[v] != 2 and M[u][v] != INF and M[u][v] < d[v]:
         d[v] = M[u][v]
         p[v] = u
         color[v] = 1
 
  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum
 
for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]
 
print m_s_t()

### FIXED CODE ###

n = input()
 
inf = 10000000
 
color = [0 for i in xrange(n)]
M = [[inf for i in xrange(n)] for i in xrange(n)]
d = [inf for i in xrange(n)]
p = [-1 for i in xrange(n)]
 
def mst():
  d[0] = 0
 
  while True:
    cost = inf
    for i in xrange(n):
      if color[i] != 2 and d[i] < cost:
        cost = d[i]
        u = i
 
    if cost == inf:
      break
     
    color[u] = 2
 
    for v in xrange(n):
      if color[v] != 2 and M[u][v] != inf and M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1
 
  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum
 
for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]
 
print mst()
import  fraction
from functools import reduce

def main():
    n=int(input())
    a=list(map(int,input().split()))
    tmp = lcm(*a)
    mod=10**9 + 7
    m=0
    ans=0
    for i, v in enumerate(a):
        m=tmp//v
        ans+=m%mod
    ans = ans % mod
    print(ans)

def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__=='__main__':
    main()


### FIXED CODE ###

import  fractions
from functools import reduce
import sys
input = sys.stdin.readline
def main():
    n=int(input())
    a=list(map(int,input().split()))
    # tmp = lcm(*a)
    mod=pow(10,9) + 7
    m=0
    ans=0
    tmp = a[0]
    for i in range(1,len(a)):
        tmp = (tmp*a[i]) // fractions.gcd(tmp,a[i])
    
    for i,v in enumerate(a):
        m=tmp//v
        ans+=m
    ans = ans % mod
    print(ans)


if __name__=='__main__':
    main()
A,B,K=map(int,input().split())

def ans120(A:int, B:int, K:int):
    l=sorted([A,B])
    ans_list=[1]
    for i in range(2,l[1]):
        if A%i==0 and B%i==0:
            ans_list.append(i)
    return ans_list[K-1]

print(ans120(A,B,K))

### FIXED CODE ###

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

def ans120(A:int, B:int, K:int):
    if A>=B:
        n=A
    else:
        n=B
    ans_list=[]
    for i in range(1,n+1):
        if A%i==0 and B%i==0:
            ans_list.append(i)
    return ans_list[-K]

print(ans120(A,B,K))
s = {"a":input(), "b":input(), "c":input()}
x = "a"
while len(s[x])!=0:
    i = s[x].pop[0]
    x = i
print(x.upper())


### FIXED CODE ###

s = {"a":input(), "b":input(), "c":input()}
x = "a"
while len(s[x])!=0:
    i = s[x][0]
    s[x]=s[x][1:]
    x = i
print(x.upper())
#コピペです。
l = input()
for i in range(0, 5) 　print(l[i], end="")
for i in range(6, 13) 　print(l[i], end="")
for i in range(14, 19) 　print(l[i], end="")

### FIXED CODE ###

l = input()
for i in range(0, 5):
	print(l[i], end="")
print(" ", end="")
for j in range(6, 13):
	print(l[j], end="")
print(" ", end="")
for k in range(14, 19):
	print(l[k], end="")
import collections

n = int(input())
d = list(map(int, input().split()))
e = collections.Counter(d)

if d[0] != 0:
    print(0)
    exit()

cntsum = 1
judge_cnt = 0

if e[1] == 0:
    print(0)
    exit()

m = max(e)
e2 = dict(sorted(e.items()))
e3 = list(e2.values())
e4 = list(e2.keys())
#print(e2)
#print(e3)
#print(e4)

tmp=0
for i in e4:
    if i-tmp>=2:
        print(0)
        exit()
    tmp=i
    
cntsum = 1
for i in range(1, len(e3)):
    cntsum *= e3[i - 1] ** e3[i]
print(cntsum)

### FIXED CODE ###

n=int(input())
print((n-1)//2)
A = int(input())
B = int(input())
print('LESS' if A < B else 'GREATER' A > B else 'EQUAL')

### FIXED CODE ###

A = int(input())
B = int(input())

if A < B:
    print('LESS')
elif A > B:
    print('GREATER')
else:
    print('EQUAL')
import sys
input = sys.stdin.readline

n, m, q = [int(x) for x in input().split()]
abcd = [[int(x) for x in input().split()] for _ in range(q)]
all_pattern = []
start = '1'
def dfs(s):
    last_s = int(s[-1])
    next_s = [str(x) for x in range(last_s, m + 1)]
    for i in next_s:
        t = s + i
        if len(t) == n + 1:
            all_pattern.append(t[1:])
        else:
            dfs(t)
dfs(start)
ans = 0
for pattern in all_pattern:
    res = 0
    for i in range(q):
        a, b, c, d = abcd[i]
        if int(pattern[b - 1]) - int(pattern[a - 1]) == c:
            res += d
    ans = max(ans, res)
print(ans)

    





### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m, q = [int(x) for x in input().split()]
abcd = [[int(x) for x in input().split()] for _ in range(q)]
all_pattern = []
start = ['1']

def dfs(s):
    last_s = int(s[-1])
    next_s = [str(x) for x in range(last_s, m + 1)]
    for i in next_s:
        t = s[:]
        t.append(i)
        if len(t) == n + 1:
            all_pattern.append(t[1:])
        else:
            dfs(t)
dfs(start)
ans = 0
for pattern in all_pattern:
    res = 0
    for i in range(q):
        a, b, c, d = abcd[i]
        if int(pattern[b - 1]) - int(pattern[a - 1]) == c:
            res += d
    ans = max(ans, res)
#print(all_pattern)
print(ans)
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 桁DP, Lを超えないものと保留のもの
MOD = 10 ** 9 + 7
L = sr()
dp = (1, 2)
length = len(L)
for i in range(1, length):
    prev = dp[:]
    if L[i] == '1':
        dp[0] = prev[0] * 3 + prev[1]
        dp[1] = prev[1] * 2
    else:
        dp[0] = prev[0] * 3
        dp[1] = prev[1]

answer = sum(dp)
print(answer%MOD)


### FIXED CODE ###

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

L = list(sr())
MOD = 10 ** 9 + 7
bit_len = len(L)

dp_any = 1 # 1桁目が(0, 0)の組み合わせ, dp_any はi+1桁目がどんな数字でも条件を満たす
dp_spe = 2
for i in range(1, bit_len):
    x, y = dp_any, dp_spe
    if L[i] == '1':
        dp_any = x * 3 + y
        dp_spe = y * 2
    else:
        dp_any = x * 3
        dp_spe = y
    dp_any %= MOD
    dp_spe %= MOD

answer = (dp_any + dp_spe) % MOD
print(answer)
import math


N = int(input())
# h = list(map(int, input().split(" ")))
h_str = input()
h = []
for h_i in h_str.split(" "):
    h.append(int(h_i))

dp = [math.inf] * N
dp[0] = 0
for i in range(N):
    for j in (i + 1, i + 2):
        if j < N:
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print(dp[N-1])

### FIXED CODE ###

N = int(raw_input())
h_str = raw_input()
h = []
for h_i in h_str.split(" "):
    h.append(int(h_i))

dp = [10 ** 9 + 1] * N
dp[0] = 0
for i in range(N):
    for j in (i + 1, i + 2):
        if j < N:
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print(dp[N-1])
def search(x,r):
  low = 0
  high = len(r)-1
  mid = (low+high)//2
  while low<=high:
    rr = r[mid]-x
    ll = r[mid+1]-x
    if rr*ll<=0:
      return(abs(rr),abs(ll))
    elif r[mid]-x > 0:
      high = mid
      mid = (low+high)//2
    else:
      low = mid
      mid = (low+high)//2
      

a, b, q = [int(i) for i in input().split()]
s = []
for i in range(a):
	s.append(int(input()))
t = []
for i in range(b):
	t.append(int(input()))
x = []
for i in range(q):
	x.append(int(input()))

for xx in x:

  s_l = float('inf')
  s_r = float('inf')
  if s[-1] - xx <= 0:
    s_l = abs(s[-1] - xx)
  elif s[0] - xx >= 0:
    s_r = abs(s[0] - xx)
  else:
  	s_l,s_r=search(xx,s)
  
  t_l = float('inf')
  t_r = float('inf')
  if t[-1] - xx <= 0:
    t_l = abs(t[-1] - xx)
  elif t[0] - xx >= 0:
    t_r = abs(t[0] - xx)
  else:
  	t_l,t_r=search(xx,t)
  
  #print(s_l,s_r,t_l,t_r)
  
  #l = max(s_l,t_l)
  #r = max(s_r,t_r)
  if s_l <= t_l:
    l = t_l
    lr = s_l*2 + t_r
  else:
    r = s_l
    lr = t_l*2 + s_r
  if s_r <= t_r:
    r = t_r
    rl = s_r*2 + t_l
  else:
    r = s_r
    rl = t_r*2 + s_l
 
  ans = min(l,r,lr,rl)
  print(ans)
  

### FIXED CODE ###

from bisect import bisect

a, b, q = [int(i) for i in input().split()]
s = []
for i in range(a):
	s.append(int(input()))
s = [-float('inf')] + s + [float('inf')]
t = []
for i in range(b):
	t.append(int(input()))
t = [-float('inf')] + t + [float('inf')]
x = []
for i in range(q):
	x.append(int(input()))

for xx in x:
  
  s_i = bisect(s,xx)
  s_r = abs(xx - s[s_i])
  s_l = abs(xx - s[s_i-1])
  t_i = bisect(t,xx)
  t_r = abs(xx - t[t_i])
  t_l = abs(xx - t[t_i-1])

  
  #print(s_l,s_r,t_l,t_r)
  
  #l = max(s_l,t_l)
  #r = max(s_r,t_r)
  if s_l <= t_l:
    l = t_l
    lr = s_l*2 + t_r
  else:
    l = s_l
    lr = t_l*2 + s_r
  if s_r <= t_r:
    r = t_r
    rl = s_r*2 + t_l
  else:
    r = s_r
    rl = t_r*2 + s_l
 
  ans = min(l,r,lr,rl)
  print(ans)
N = int(input())
XYH_list = [list(map(int, input().split())) for i in range(N)]

for i in range(1, 101):
    for j in range(1, 101):
        tmpH = 0
        tmpI = i
        tmpJ = j
        for k, xyh in enumerate(XYH_list):
            if k == 0:
                for l in range(1, 201):
                    if xyh[2] == max((l - abs(xyh[0] - i) - abs(xyh[1] - j)), 0):
                        tmpH = l
                        break
            if xyh[2] == max((tmpH - abs(xyh[0] - i) - abs(xyh[1] - j)), 0):
                if k == N - 1:
                    ans = [str(tmpI), str(tmpJ), str(tmpH)]
                continue
            else:
                break
print(' '.join(ans))


### FIXED CODE ###

N = int(input())
XYH_list = [list(map(int, input().split())) for i in range(N)]
XYH_list = sorted(XYH_list, key=lambda x: x[2], reverse=True)

for xi in range(0, 101):
    for yi in range(0, 101):
        tmpH = 0
        for k in range(N):
            x,y,h = XYH_list[k]
            if k == 0:
                tmpH =h + abs(x - xi) + abs(y - yi)
            if h == max((tmpH - abs(x - xi) - abs(y - yi)), 0):
                if k == N - 1:
                    ans = [str(xi), str(yi), str(tmpH)]
                continue
            else:
                break
print(' '.join(ans))
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]

import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = str(intinput())
K = intinput()
s = len(str(N))
flag = 0
dp = [[[0] * 3 for i in range(5)] for j in range(150)]
dp[0][0][0] = 1
dp[1][1][1] += int(N[0])-1
dp[2][2][1] += int(N[1])-1
dp[3][3][1] += int(N[2])-1
for h in range(1,s+1):
    dp[h][0][0] = 0
    dp[h][0][1] = 1
    for i in range(1,4):
        dp[h][i][0] += dp[h-1][i-1][0]
        dp[h][i][1] +=  dp[h-1][i-1][1] * 9 + dp[h-1][i][0] + dp[h-1][i][1]

print(dp[s][K][0]+dp[s][K][1])
            
                
                
 



### FIXED CODE ###

#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]

import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = str(intinput())
K = intinput()
s = len(str(N))
dp = [[[0] * 2 for i in range(4)] for j in range(s+1)]
dp[0][0][0] = 1
for h in range(1,s+1):
    dp[h][0][1] = 1
    for i in range(1,4):
        for j in range(0,2):
            if j == 1:      
                for k in range(0,10):
                    if int(N[h-1]) == 0:
                        dp[h][i][j] += dp[h-1][i][1] + dp[h-1][i-1][1]*9
                        break
                    if int(N[h-1]) > k:
                        if k == 0:
                            dp[h][i][j] += dp[h-1][i][0] + dp[h-1][i][1]
                        if k != 0:
                            dp[h][i][j] += dp[h-1][i-1][0] + dp[h-1][i-1][1]
                    if int(N[h-1]) <= k:
                        dp[h][i][j] += dp[h-1][i-1][1]
            if j == 0:
                if int(N[h-1]) == 0:
                    dp[h][i][j] += dp[h-1][i][0]
                else:
                    dp[h][i][j] += dp[h-1][i-1][0]

print(dp[s][K][0]+dp[s][K][1])
# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def comb(lst, x):
	from itertools import combination as c
	return list(comb(lst, x))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}
def smaller(lst, x): return bisect_left(lst, x) -1
def smallerEq(lst, x): return bisect_right(lst, x) -1

def solve(n):
	lst = [0] * 1000
	for i in range(1, 101):
		for j in range(1, 101):
			for k in range(1, 101):
				val = (i**2) + (j**2) + (k**2) + (i*j) + (i*k) + (j*k)
				if val >= 1 and val <= 1000:
					lst[val-1] += 1
	for i in range(1, n+1):
		print(lst[i])
	return


n = int(input())
print(solve(n))

### FIXED CODE ###

# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def comb(lst, x):
	from itertools import combination as c
	return list(comb(lst, x))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}
def smaller(lst, x): return bisect_left(lst, x) -1
def smallerEq(lst, x): return bisect_right(lst, x) -1

def solve(n):
	lst = [0] * 10000
	for i in range(1, 101):
		for j in range(1, 101):
			for k in range(1, 101):
				val = (i**2) + (j**2) + (k**2) + (i*j) + (i*k) + (j*k)
				if val >= 1 and val <= 10000:
					lst[val-1] += 1
	for i in range(0, n):
		print(lst[i])

n = int(input())
solve(n)
def MI():  return map(int, input().split())
N,Q=MI()
graph=[[] for i in range(N)]
for i in range(1,N):
  a,b=MI()
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
point=[0]*N  
for i in range(Q):
  p,x=MI()
  point[p-1]+=x
def dfs(now,pre=-1):  
  for next in graph[now]:
    if next==pre:
      continue
    point[next]+=point[now]
    dfs(next,now)
dfs(0)
print(*point)

### FIXED CODE ###

#ika tako
import sys
n, q = map(int, input().split())
lines = sys.stdin.readlines()
links = [set() for _ in range(n)]
for line in lines[:n - 1]:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
adds = [0] * n
for line in lines[n - 1:]:
    p, x = map(int, line.split())
    p -= 1
    adds[p] += x
ans = [-1] * n
q = [(0, 0)]
while q:
    v, a = q.pop()
    a += adds[v]
    ans[v] = a
    for u in links[v]:
        if ans[u] == -1:
            q.append((u, a))
print(*ans)
N = int(input())

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

X.sort(key = lambda item: item[2] ,reverse = True)

for i in range(101):
    for j in range(101):
        h = X[0][2] + abs(X[0][0] - i) + abs(X[0][1] - j)
        
        ok = True
        for k in range(N):
            if X[0][2] != h - abs(X[k][0] - i) - abs(X[k][1] - j)
                ok = False
        
        if ok:
            print(i,j)
            exit()

### FIXED CODE ###


N = int(input())

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

X.sort(key = lambda item: item[2] ,reverse = True)

for i in range(101):
    for j in range(101):
        h = X[0][2] + abs(X[0][0] - i) + abs(X[0][1] - j)

        ok = True
        for k in range(N):
            if X[k][2] != max((h - abs(X[k][0] - i) - abs(X[k][1] - j)), 0):
                ok = False

        if ok:
            print(i, j, h)
            exit()
a = int(input())
b = int(input())

m = a*b
s = a+b*2

print("m,s")

### FIXED CODE ###

x, y = input().split()
print(int(x)*int(y), (int(x)+int(y))*2)
S=int(input())

h=S/3600

m=S%3600/60

s=S%3600%60

print(":".join(h:m:s))

### FIXED CODE ###

S=int(input())
 
h=S//3600
 
m=(S%3600)//60
 
s=(S%3600)%60
 
print('{0}:{1}:{2}'.format(h,m,s))
n=input()
s=input()
c,m=0,0
for i in range(n):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
print(m)

### FIXED CODE ###

input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)
import sys

N, K = map(int, input().split())
A = list(map(int, input().split()))
maxA = max(A)
if K > maxA:
	print("IMPOSSIBLE")
	sys.exit()

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

for i in range(1,N):
	if i == 1:
		temp = GCD(A[0],A[1])
	else:
		temp = GCD(temp, A[i])

if temp == 1:
	ans = "POSSIBLE"
else:
	if K//temp == 0:
		ans = "POSSIBLE"
	else:
		ans = "IMPOSSIBLE"

print(ans)


### FIXED CODE ###

import sys

N, K = map(int, input().split())
A = list(map(int, input().split()))
maxA = max(A)
if K > maxA:
	print("IMPOSSIBLE")
	sys.exit()

if K in A:
	print("POSSIBLE")
	sys.exit()

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

for i in range(1,N):
	if i == 1:
		temp = GCD(A[0],A[1])
	else:
		temp = GCD(temp, A[i])

if K % temp == 0:
	ans = "POSSIBLE"
else:
	ans = "IMPOSSIBLE"
print(ans)
import sys
n = int(input())
a = list(map(int, input().split()))
x1, x2 = [], []
y1, y2 = [], []
for i in range(n//2):
  if not a[2*i] in x1:
    x1.append(a[2*i])
    y1.append(1)
  else:
    y1[x1.index(a[2*i])] += 1

for i in range(n//2):
  if not a[2*i+1] in x2:
    x2.append(a[2*i+1])
    y2.append(1)
  else:
    y2[x2.index(a[2*i+1])] += 1

if len(x1)==1 and len(x2)==1 and x1[0]!=x2[0]:
  print(0)
  sys.exit()

total = 0
if x1[y1.index(max(y1))]!=x2[y2.index(max(y2))]:
  total = sum(y1)-max(y1) + sum(y2) - max(y2)
elif len(x1)==1 and len(x2)==1:
  total = sum(y1)
elif len(x1)==1:
  y3 = y2.pop(x2.index(x1[0]))
  total = sum(y1)-max(y1) + sum(y2) - max(y3)
elif len(x2)==1:
  y3 = y1.pop(x1.index(x2[0]))
  total = sum(y1)-max(y3) + sum(y2) - max(y2)
else:
  y3 = y1.remove(max(y1))
  y4 = y2.remove(max(y2))
  if max(y3) >= max(y4):
    total = sum(y1) - max(y3) + sum(y2) - max(y2)
  else:
    total = sum(y1) - max(y1) + sum(y2) - max(y4)
print(total)

### FIXED CODE ###

from collections import Counter
 
def f(n,v):
	a=Counter(v[0::2]).most_common()
	b=Counter(v[1::2]).most_common()
	
	a.append([0,0])
	b.append([0,0])
	if a[0][0]!=b[0][0]:
		return n-(a[0][1]+b[0][1])
	else:
		return min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1]))
 
if __name__=="__main__":
	x=int(input())
	data=[int(i) for i in input().split()]
	print(f(x,data))
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
n = 0
if x in l1:
  if y in l1:
    print ('Yes')
    n = 1
elif x in l2:
  if y in l2:
    print ('Yes')
    n = 1
else:
  if y in l3:
    print ('Yes')
    n = 1
if n == 0:
  print ('No')

### FIXED CODE ###

x,y = (int(x) for x in input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
n = 0
if x in l1:
  if y in l1:
    print ('Yes')
    n = 1
elif x in l2:
  if y in l2:
    print ('Yes')
    n = 1
else:
  if y in l3:
    print ('Yes')
    n = 1
if n == 0:
  print ('No')
-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)


### FIXED CODE ###

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

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)
a, b, c , x = [int(input()) i for range(4)]
n = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        n += 1
print(n)




### FIXED CODE ###

a, b, c, x = [int(input()) for i in range(4)]
n = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        n += 1
print(n)
a = list(input())

for i in a:
    if i == "a":
        c1 = 1
    elif i == "b":
        c2 = 1
    elif i == "c":
        c3 = 1

if c1 == 1 and c2 == 1 and c3 == 1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a = list(input())
if a[0] == a[1] or a[1] == a[2] or a[2] == a[0]:
    print("No")
else:
    print("Yes")
S = input()
num = 0
bits = format(num , 'b').zfill(len(S) - 1)
ans = 0
for i in range(2 ** (len(S) - 1)):
  index = 0
  for j in range(len(S) - 1):
    if(bits[i] == 1):
      ans += int(S[:i])
      index = i + 1
    ans += int(S[index:])
  num += 1
  bits = format(num , 2).zfill(len(S) - 1)
print(ans)

### FIXED CODE ###

S = input()
num = 0
bits = format(num , 'b').zfill(len(S) - 1)
ans = 0
for i in range(2 ** (len(S) - 1)):
  index = 0
  for j in range(len(S) - 1):
    if(bits[j] == "1"):
      ans += int(S[index:j + 1])
      index = j + 1
  ans += int(S[index:])
  num += 1
  bits = format(num , 'b').zfill(len(S) - 1)
print(ans)
N,A = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

### FIXED CODE ###

N = int(input())
A = int(input())

if N % 500 <= A:
        print("Yes")
else:
        print("No")