Harryxun/stf_run huggingface dataset:
n = int(input())
A = [int(i) for i in input().split()]

if A[0] <= A[1]:
    flag = 1
else:
    flag = -1
cnt = 1
x = A[1]
for i in range(2, n):
    if flag == 1:
        if x <= A[i]:
            pass
        else:
            cnt += 1
            flag = 0
    if flag == -1:
        if x < A[i]:
            cnt += 1
            flag = 0
        else:
            pass
    else:
        if x < A[i]:
            flag = 1
        elif x > A[i]:
            flag = -1
        else:
            flag = 0
    x = A[i]
    
print(cnt)

### FIXED CODE ###

n = int(input())
A = [int(i) for i in input().split()]

if n == 1:
    cnt = 1
else:
    if A[0] < A[1]:
        flag = 1
    elif A[0] > A[1]:
        flag = -1
    else:
        flag = 0
    
    cnt = 1
    x = A[1]
    for i in range(2, n):
        if flag == 1:
            if x <= A[i]:
                pass
            else:
                cnt += 1
                flag = 0
                
        elif flag == -1:
            if x < A[i]:
                cnt += 1
                flag = 0
            else:
                pass
            
        else:
            if x < A[i]:
                flag = 1
            elif x > A[i]:
                flag = -1
            else:
                flag = 0
        #print('x', x, 'A[i]', A[i], 'flag', flag, 'cnt', cnt)
        x = A[i]
    
print(cnt)
N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[0]*N
Pxx = []
sumx = 0
for i in range(N):
    Px[i] = (1+P[i])/2
for j in range(N-K+1):
    for k in range(K):
        sumx += Px[j+k]
        Pxx.append(sumx)
    sumx = 0
print(f'{max(Pxx):.12f}')

### FIXED CODE ###

N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[]
for i in range(N):
    Px.append((1+P[i])/2)
temp_num = sum(Px[0:K])
temp_max = sum(Px[0:K])
#print(Px)
for j in range(N-K):
    #print(temp_num)
    temp_num = temp_num-Px[j]+Px[j+K]
    if temp_max <temp_num:
        temp_max=temp_num
print(temp_max)
N = int(input())
A = list(map(int, input().split()))

mod = int(1e+9 + 7)
L = [0, 0, 0]
pi = 1
for i in range(N):
  j = 0
  while L[j] != A[i]:
    j += 1
  n = 0
  for k in range(3):
    if L[k] == A[i]:
      n += 1
  if j != 3:
    L[j] += 1
  pi *= n
  pi %= mod
print(pi)

### FIXED CODE ###

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

mod = int(1e+9 + 7)
L = [0, 0, 0]
pi = 1
for i in range(N):
  j = 0
  while L[j] != A[i]:
    j += 1
    if j == 3:
      break
  n = 0
  for k in range(3):
    if L[k] == A[i]:
      n += 1
  if j != 3:
    L[j] += 1
  pi *= n
  pi %= mod
print(pi)
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]

ans = 0
for i in range(M):
    ab_list = [[] for i in range(N)]
    for j in range(M):
        if i != j:
            k = ab[j]
            ab_list[k[0] - 1].append(k[1] - 1)
            ab_list[k[1] - 1].append(k[0] - 1)
            
    DFS_list = [False] * N
    
    def DFS(v):
        DFS_list[v] = True
        for j in ab_list[v]:
            if not DFS_list[j]:
                DFS(j)
    DFS(i)
    if False in DFS_list:
        ans += 1
print(ans)

### FIXED CODE ###

def wf(this_graf):
    s = len(graf)
    for k in range(s):
        for i in range(s):
            for j in range(s):
                this_graf[i][j] = min(this_graf[i][j], this_graf[i][k] + this_graf[k][j])
    return this_graf

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
graf = [[10 ** 10 for i in range(n)] for j in range(n)]

for i, j in ab:
    graf[i - 1][j - 1] = 1
    graf[j - 1][i - 1] = 1

import copy
cnt = 0

for i, j in ab:
    this_graf = copy.deepcopy(graf)
    tmp = 0
    this_graf[i - 1][j - 1] = 10 ** 10
    this_graf[j - 1][i - 1] = 10 ** 10
    this_graf = wf(this_graf)
    for i in range(n):
        for j in range(n):
            if this_graf[i][j] == 10 ** 10:
                tmp = 1
                break
        if tmp:
            break
    cnt += tmp

print(cnt)
from sys import stdin
X,Y = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
tmp = 10**9+7
P = set(list(range(0,101))) - set(P)
P.sort(reverse=True)


ans = 0
for i in P:
    if abs(i-X) <= tmp:
        ans = i
        tmp = abs(i-X)
        
print(ans)
        

### FIXED CODE ###

from sys import stdin
X, Y = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
tmp = 10**9+7
P = set(list(range(-200, 200))) - set(P)
P = list(P)
P.sort(reverse=True)


ans = 0
for i in P:
    if abs(X-i) <= tmp:
        ans = i
        tmp = abs(X-i)

print(ans)
s=input()
l=[]

p=s[0]
seq=1

for c in s[1:]
  if c==p:
    seq+=1
  else:
    l.append(seq)
    seq=1
    prev=c
ans=float("inf")

d1=min([a+b for a,b in zip(l[0::2],l[1::2])])
d2=min([a+b for a, b in zip(l[1::2],l[2::2])])
print(min(d1,d2))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)
T = 10**9+7

N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B+1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R+1, i) % T) * (nCr(B-1, i-1) % T) % T)

def factorial(n, s):
    f = 1
    for i in range(s, n+1):
        f *= i
    return f

def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r+1) // factorial(n - r, 1)


### FIXED CODE ###

def factorial(n, s):
    f = 1
    for i in range(s, n + 1):
        f *= i
    return f


def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r + 1) // factorial(n - r, 1)


T = 10 ** 9 + 7
N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B + 1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R + 1, i) % T) * (nCr(B - 1, i - 1) % T) % T)
s=str(input())

N=int(input())
cnt=0
f=''
b=''
for i in range(N):
  inp=str(input())
  if len(inp)==1:
    cnt+=1
  else:
    F,c=int(inp[2]),inp[4]
    if F==1:
      if cnt%2==0:
        f=c+f
      else:
        b+=c
    else:
      if cnt%2==0:
        b+=c
      else:
        f=c+f
if cnt%2==0:
  print(f+s+b)
else:
  ans=f+s+b
  L=len(ans)
  if L==1:
    print(ans)
  else:
    if L%2==1:
      f=ans[0:L//2]
      s=ans[L//2]
      b=ans[L//2+1:L]
      print(''.join(list(reversed(b))))+s+''.join(list(reversed(f)))
    else:
      f=ans[0:L//2]
      b=ans[L//2:L]
      f_=''.join(list(reversed(b)))
      b_=''.join(list(reversed(f)))
      print(f_+b_)

### FIXED CODE ###

s=str(input())

N=int(input())
cnt=0
f=''
b=''
for i in range(N):
  inp=str(input())
  if len(inp)==1:
    cnt+=1
  else:
    F,c=int(inp[2]),inp[4]
    if F==1:
      if cnt%2==0:
        f=c+f
      else:
        b+=c
    else:
      if cnt%2==0:
        b+=c
      else:
        f=c+f
if cnt%2==0:
  print(f+s+b)
else:
  ans=f+s+b
  L=len(ans)
  if L==1:
    print(ans)
  else:
    if L%2==1:
      f=ans[0:L//2]
      s=ans[L//2]
      b=ans[L//2+1:L]
      f_=''.join(list(reversed(b)))
      b_=''.join(list(reversed(f)))
      print(f_+s+b_)
    else:
      f=ans[0:L//2]
      b=ans[L//2:L]
      f_=''.join(list(reversed(b)))
      b_=''.join(list(reversed(f)))
      print(f_+b_)
n = int(input())
a = list(map(int, input().split()))
l = []

for i in a:
	s = 0
	while i % 2 == 0:
		i = i/2
		s += 1
	l.append(s)

print(min(l))



### FIXED CODE ###

print(int(input())%9)
n,m=map(int,input().split())
a=map(int,input().split())

from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)

l=1
for i in a:
    l=l*i//2//gcd(l,i//2)
    if l>m:
        break

ans=1 if l<=m else 0
m-=l

print(ans+max(0,m//(2*l)))

### FIXED CODE ###

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

from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
l=1

max2=0
min2=1000

for i in a:
    factor=(i^(i-1)).bit_length()
    max2=max(max2,factor)
    min2=min(min2,factor)
    l=l*i//2//gcd(l,i//2)
    if l>m:
        break

if l>m or min2!=max2:
    print(0)
else:
    ans=1 if l<=m else 0
    m-=l
    print(ans+max(0,m//(2*l)))
while True:
    x,y = map(int, input().split(' '))
    if x == 0 and y == 0:
        break
    elif x => y:
        print (y,x)
    else:
        print (x,y)

### FIXED CODE ###

while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    elif x <= y :
        print (x,y)
    else :
        print (y,x)
k, x = input().split()
print(*list(range(x-k+1, x+k)))


### FIXED CODE ###

k, x = map(int, input().split())
print(*list(range(x-k+1, x+k)))
import itertools
n,k = map(int,input().split())
p = list(map(int,input().split()))
num = 0
maxnum = 0
for i in range(n-k+1):
    num = 0.5*(sum(p[i:i+k])+k)
    if num > maxnum:
        maxnum = num
print("{:.6f}".format(maxnum)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
wa = sum(p[0:k])
next_wa = wa
for i in range(n-k):
    next_wa = next_wa - p[i] + p[i+k]
    if  next_wa > wa:
        wa = next_wa
print(0.5*(wa+k))
import math
r = int(input())
print(r * r * math.pi, 2 * r * math.pi)

### FIXED CODE ###

import math
r = float(input())
print(r * r * math.pi, 2 * r * math.pi)
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 10**9
for i in a:
    cnt[i-1] += 1
if n == a.count(1):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        exit()
print('YES')
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for n in range(N):
    if n%2==1:
        flag=True
        
if flag:
    print 'NO'
else:
    print 'YES'

### FIXED CODE ###

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

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC
def main():
    import collections
    import sys
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<3:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()
import math

print(int(input() * 2 * math.pi)

### FIXED CODE ###

import math

print(int(input()) * 2 * math.pi)
N = input()
X = input()
T = input()

a = N//X
min_T = T*a

print(min_T)

### FIXED CODE ###

N, X, T = map(int, input().split())

a = N // X
if N%X == 0:
	min_T=T*a
else:
	min_T = T*(a+1)

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

A = list(map(int,input().split()))
dp = [False for i in range(N+10)]
memo = [[] for i in range(N+10)]
taiou = [[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]
matchi = []
for i in range(1,10):
    if i in A:
        matchi.append(taiou[i-1])
matchi = sorted(matchi,key = lambda x:-x[0])
matchi = sorted(matchi,key = lambda x:x[1])
# for i in range(1,len(matchi)):
#     if matchi[i][1] == matchi[i-1][1]:

minma = matchi[0][1]
# print(matchi)
# print(minma)
# dp[0] = F
for i in range(len(matchi)):
    dp[matchi[i][1]] = True
    memo[matchi[i][1]].append(matchi[i][0])
for i in range(N):
    for j in range(len(matchi)):
        if dp[i-matchi[j][1]]:
            dp[i] = True
            memo[i] = memo[i] + memo[i-matchi[j][1]]
            memo[i].append(matchi[j][0])
            break
# print(dp)
# print(memo)
maxi = N
for i in range(N//minma,0,-1):
    if dp[N-i*minma]:
        maxi = i
        # print(maxi)
        break

ans = sorted([matchi[0][0]]*maxi + memo[N-maxi*minma],reverse = True)
for i in range(len(ans)):
    print(ans[i],sep='',end='')
print('')


### FIXED CODE ###

A,B = map(int,input().split())
# N = int(input())
if B%A == 0:
    print(A+B)
else:
    print(B-A)
a,b=int(input().split())
if a-2*b>0:
  print(a-2*b)
else:
  print(0)


### FIXED CODE ###

a,b=map(int,input().split())
if a-2*b>0:
    print(a-2*b)
else:
    print(0)
N = int(input())
A = list(map(int, input().split()))
List = [0]*N


for i, a in enumerate(A):
  ret[int(a-1)] = str(i+1)

  
print(" ".joint(ret))





### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
List = [0]*N


for i, a in enumerate(A):
  List[int(a)-1] = str(i+1)

  
print(" ".join(List))
# coding: utf-8
import math
 
A, B, C, D = map(int, input().split())
sub = abs(A - B)
num1 , num2, num3 = (sub // C + 1), (sub // D + 1), (sub // (C * D // math.gcd(C, D))) + 1
        
print(sub - num1 - num2 + num3 + 1)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)
n=int(input())
mat=[[]*n for _ in range(n)]
group=[0]*n
group[0]=1
for i in range(n-1):
    u, v, w = map(int, input().split())
    mat[u-1].append((v-1, w))
    mat[v-1].append((u-1, w))
def C(kw, p, l):
    global group
    if kw[1]%2==1:
        p*=-1
    group[kw[0]]=p
    for kwi in mat[kw[0]]:
        if kwi[0]!=l:
            C(kwi, p, kw[0])
for kwi in mat[0]:
    C(kwi, 1, 0)
for gi in group:
    if gi>0:
        print(1)
    else:
        print(0)

### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)
n=int(input())
mat=[[] for i in range(n)]
group=[0]*n
group[0]=1
for i in range(n-1):
    u, v, w = map(int, input().split())
    mat[u-1].append((v-1, w))
    mat[v-1].append((u-1, w))
def C(kw, p, l):
    global group
    k, w = kw
    if w%2==1:
        p*=-1
    group[k]=p
    for kwi in mat[k]:
        if kwi[0]!=l:
            C(kwi, p, k)
for kwi in mat[0]:
    C(kwi, 1, 0)
for gi in group:
    if gi>0:
        print(1)
    else:
        print(0)
x = map(int, input().split())
print(x[0][0]+x[1][0]+x[2][0])

### FIXED CODE ###

x=input().split()
print(x[0][0]+x[1][0]+x[2][0])
N,K = map(int,input().split())
V = list(map(int,input().split()))

if N < K:
    ans = sum(V)
    V = sorted(V)
    i = 0
    while True:
        if V[i] >= 0:
            break
        ans += abs(V[i])
        i += 1
    print(ans)
    exit()


ans = 0
for a in range(K,-1,-1):
    for i in range(a+1):
        left = V[:a-i]
        if i != 0:
            right = V[-i:]
        else:
            right = []
        lr = sorted(left+right)
        tans = sum(lr)
        for j in range(min(len(lr),K-a)):
            if lr[j] < 0:
                tans += abs(lr[j])
        ans = max(ans , tans)
print(ans)


### FIXED CODE ###

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

if N < K:
    ans = sum(V)
    V = sorted(V)
    i = 0
    while len(V) > i:
        if V[i] >= 0:
            break
        ans += abs(V[i])
        i += 1
    print(ans)
    exit()


ans = 0
for a in range(K,-1,-1):
    for i in range(a+1):
        left = V[:a-i]
        if i != 0:
            right = V[-i:]
        else:
            right = []
        lr = sorted(left+right)
        tans = sum(lr)
        for j in range(min(len(lr),K-a)):
            if lr[j] < 0:
                tans += abs(lr[j])
        ans = max(ans , tans)
print(ans)
a, b = map(int, input().split())

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 = int(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
    

### FIXED CODE ###

s = str(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        if i==0:
            if t[1]=="D":
                t[0]="P"
            else:
                t[0]="D"
        elif i==len(t)-1:
            t[i]="D"
        else:
            if t[i-1]=="P":
                t[i]="D"
            elif t[i+1]=="D":
                t[i]="P"
            elif t[i+1]=="?":
                t[i]="P"
                t[i+1]="D"

### FIXED CODE ###

import sys
t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        if len(t)==1:
            print("D")
            sys.exit()
        else:
            if i==0:
                if t[1]=="D":
                    t[0]="P"
                else:
                    t[0]="D"
            elif i==len(t)-1:
                t[i]="D"
            else:
                if t[i-1]=="P":
                    t[i]="D"
                elif t[i+1]=="D":
                    t[i]="P"
                elif t[i+1]=="?":
                    t[i]="P"
                    t[i+1]="D"
                else:
                    t[i]="D"
print("".join(t))
H, W = map(int, input().split())
h, w = map(int input().split())

s = (H - h) * (W - w)

print(s)

### FIXED CODE ###

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

s = (H - h) * (W - w)

print(s)
N = int(input().strip())



a = []
c =0
f = 0

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

    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c+=1
		else:
			f=0
			c=0
	else :
		f=0
		c=0

if(c >= 3):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

val = input()

if(val[-1] == 's'):
  print(val + 'es')
else:
  print(val+'s')
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
m = 0
for i in range(N):
    m += B[a[i] - 1]
for i in range(N-1):
    if a[i] + 1 == a[i + 1]:
        m += C[a[i] - 1]
print(m)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
m = 0
for i in range(N):
    m += B[A[i] - 1]
for t in range(N-1):
    if A[t] + 1 == A[t + 1]:
        m += C[A[t] - 1]
print(m)
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

check = [0] * (n+10)

for i in t:
    check[i] += 1

wait = False
time_cnt = 0
people_cnt = 0
ans = 0

for i in range(len(check)):
    if wait == False:
        if check[i] > 0:
            wait = True
            people_cnt += check[i]
            time_cnt = 1
            continue
        else:
            continue
        
    if people_cnt > c:
        ans += people_cnt//c
        people_cnt = people_cnt%c
        time_cnt = 1
        
    
    if time_cnt > k:
        ans += 1
        people_cnt = 0
        time_cnt = 0
        wait = False
    
    people_cnt += check[i]
    time_cnt += 1
else:
    if people_cnt > 0:
        ans += people_cnt//c
    if people_cnt%c > 0:
        ans += 1

print(ans)

### FIXED CODE ###

n, c, k = map(int, input().split())
from collections import deque

t = [int(input()) for _ in range(n)]
t.sort()
t=deque(t)

ans = 1
bus=t[0]+k
cnt = 0

while t:
    i=t.popleft()
    if i>bus:
        bus=i+k
        ans+=1
        cnt=1
    elif cnt==c:
        bus=i+k
        ans+=1
        cnt=1
    else:
        cnt+=1

print(ans)
N=int(input())
A=input().split
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')





### FIXED CODE ###

N=int(input())
A=input().split()
x=0
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
V =  list(map(int,input().split()))
l = V[0::2]
r = V[1::2]
#print(l,r)
from collections import Counter

l = list(Counter(l).most_common(2))
r = list(Counter(r).most_common(2))

if l[0][0] != r[0][0]:
    ans = N -( l[0][1] + r[0][1])
elif l[0][0] == r[0][0]:
    if len(l) == 1 or len(r) == 1:
        ans = N//2
    elif l[1][1] > r[1][1]:
        ans = N-(l[0][1] +  r[1][1])
    elif l[1][1] < r[1][1]:
        ans = N-(l[1][1] +  r[0][1])

print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())
v = list(map(int,input().split()))
ac = Counter(v[::2]).most_common(2)
bc = Counter(v[1::2]).most_common(2)



if ac[0][0] != bc[0][0]:            #奇数列と偶数列の最頻数が同じ要素でない場合
    ans =  n - ac[0][1] - bc[0][1]  #全体の数から書き換える必要がない数（それぞれの最頻値）を引けばよい
else:                               #奇数列と偶数列の最頻数が同じ要素の数の場合
    if len(bc) == 1 or len(ac) == 1:#全部同じ数の場合 
        ans = n // 2
    else: #２番目の最頻数を比較し、大きいほうの列の最も多大きい最頻数ともう一方の列の2番目に大きい最頻数を書き換える
        ans = n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])
print(ans)