Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def main():
    N = int(input())
    ans = 0
    P = [int(_) for _ in input().split()]
    for i in range(N):
        if min(P[:i+1]) == P[i]:
            ans += 1
    print(ans)
main()


### FIXED CODE ###

def main():
    N = int(input())
    ans = 0
    P = [int(_) for _ in input().split()]
    for i in range(N):
        if i == 0:
            x = P[0]
        if P[i] <= x:
            ans += 1
            x = P[i]
    print(ans)
main()
### BUGGY CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

MAX = 10**9 + 7

def pow_mod_p(n, k, p):
  x = 1
  while k:
    if k % 2 == 1:
      x *= n
      x %= p
    n **= 2
    n %= p
    k >>= 1
  return x

def comb_mod_p(n, k, p):
  x = 1
  for ik in range(k):
    x *= ((n-ik) * pow_mod_p(ik+1, p-2, p))
    x %= p
  return x


def main():
  n, a, b = map(int, input().strip().split())
  sum = 1
  for i in range(1, n+1):
    sum *= 2
    sum %= MAX
  sum -= 1
  sum = sum - comb_mod_p(n, a, MAX) - comb_mod_p(n, b, MAX)
  if sum < 0:
    print(MAX + sum)
  else:
    print(sum)


if __name__=='__main__':
  main()


### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

MAX = 10**9 + 7

def pow_mod_p(n, k, p):
  x = 1
  while k:
    if k % 2 == 1:
      x *= n
      x %= p
    n **= 2
    n %= p
    k >>= 1
  return x

def comb_mod_p(n, k, p):
  x = 1
  for ik in range(k):
    x *= ((n-ik) * pow_mod_p(ik+1, p-2, p))
    x %= p
  return x


def main():
  n, a, b = map(int, input().strip().split())
  sum = pow_mod_p(2, n, MAX) - 1
  sum = sum - comb_mod_p(n, a, MAX) - comb_mod_p(n, b, MAX)
  print(sum % MAX)


if __name__=='__main__':
  main()
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

def main():
	n = int(input())
	s = tuple(input())

	ans = 0

	for i in range(3,n):
		for j in range(i-2):
			if s[i] == s[j]:
				continue
			for k in range(j+1,i):
				if s[i] != s[j] != s[k] != s[i]:
					if k - j != i - k:
						ans += 1

	print(ans)

if __name__ == '__main__':
	main()


### FIXED CODE ###

import sys
import bisect
readline = sys.stdin.readline

def main():
	n = int(input())
	s = tuple(input())

	ans = 0
	r = []
	g = []
	b = []
	for i in range(3):
		if s[i] == 'R':
			r.append(i)
		elif s[i] == 'G':
			g.append(i)
		else:
			b.append(i)

	for i in range(3,n):
		if s[i] == 'R':
			r.append(i)
		elif s[i] == 'G':
			g.append(i)
		else:
			b.append(i)

		for j in range(i-2):
			if (j-i) % 2 == 0:
				if s[i] == s[j]:
					continue
				elif 'R' not in [s[i],s[j]]:
					ans += bisect.bisect_left(r,i) - bisect.bisect_left(r,j)
					index = bisect.bisect_left(r,j + (i-j)//2 )
					if index < len(r):
						if r[index] == j + (i-j)//2:
							ans -= 1
				elif 'G' not in [s[i],s[j]]:
					ans += bisect.bisect_left(g,i) - bisect.bisect_left(g,j)
					index = bisect.bisect_left(g,j + (i-j)//2 )
					if index < len(g):
						if g[index] == j + (i-j)//2:
							ans -= 1
				elif 'B' not in [s[i],s[j]]:
					ans += bisect.bisect_left(b,i) - bisect.bisect_left(b,j)
					index = bisect.bisect_left(b,j + (i-j)//2 )
					if index < len(b):
						if b[index] == j + (i-j)//2:
							ans -= 1
			else:
				if s[i] == s[j]:
					continue
				elif 'R' not in [s[i],s[j]]:
					ans += bisect.bisect_left(r,i) - bisect.bisect_left(r,j)

				elif 'G' not in [s[i],s[j]]:
					ans += bisect.bisect_left(g,i) - bisect.bisect_left(g,j)

				elif 'B' not in [s[i],s[j]]:
					ans += bisect.bisect_left(b,i) - bisect.bisect_left(b,j)


	print(ans)

if __name__ == '__main__':
	main()
### BUGGY CODE ###

def median(list):
    list.sort()
    median = list[int((len(list)+1)/2)-1]
    return median


n = int(input())

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

for i in range(n):
    tmp_list = number_list[:i]+number_list[i+1:]
    m = median(tmp_list)
    print(m)


### FIXED CODE ###



n = int(input())

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print(tmp_list[n//2])
    else :
        print(tmp_list[n//2-1])
### BUGGY CODE ###

X,K,D=map(int,input().split())

def valid(value1, value2, diff):
    if diff%2==0:
        return value1
    else:
        return value2

min_score = abs(X)
for i in range(K):
    if abs(X-D)>abs(X+D):
        X = X+D
    else:
        X = X-D
    if min_score > abs(X):
        min_score=abs(X)
    else:
        a = min([abs(X-D), abs(X+D)])
        min_score = valid(a, abs(X), K-i)
        break

print(min_score)


### FIXED CODE ###

X,K,D=map(int,input().split())

def valid(value1, value2, diff):
    if diff%2==0:
        return value1
    else:
        return value2

if abs(X)>K:
    tmp = abs(X)//D
    if tmp>K:
        tmp=K
    if X < 0:
        X += tmp*D
    else:
        X -= tmp*D
    K -= tmp

min_score = abs(X)
for i in range(K):
    if abs(X-D)>abs(X+D):
        X = X+D
    else:
        X = X-D
    if min_score > abs(X):
        min_score=abs(X)
    else:
        a = min([abs(X-D), abs(X+D)])
        min_score = valid(a, abs(X), K-i)
        break
print(min_score)
### BUGGY CODE ###

import numpy as np
from numba import jit


@jit
def myfunc(n, k, A):
    for _ in range(k):
        l = np.zeros((n + 1,), dtype=np.int64)
        for i, a in enumerate(A[:-1]):
            l[max(0, i - a)] += 1
            l[min(n, i + a + 1)] -= 1
        A = np.cumsum(l)
    return A


def main():
    n, k = map(int, input().split())
    A = np.array(list(map(int, input().split())), dtype=np.int64)
    A = np.append(A, 0)
    print(*myfunc(n, k, A)[:-1])


if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
from numba import jit


@jit("i8, i8, i8[:]")
def myfunc(n, k, A):
    for _ in range(k):
        l = np.zeros((n + 1,), dtype=np.int64)
        for i, a in enumerate(A[:-1]):
            l[max(0, i - a)] += 1
            l[min(n, i + a + 1)] -= 1
        A = np.cumsum(l)
        if np.all(A[:-1] == n):
            break
    return A


def main():
    n, k = map(int, input().split())
    A = np.array(list(map(int, input().split())), dtype=np.int64)
    A = np.append(A, 0)
    print(*myfunc(n, k, A)[:-1])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [[0] * 2 for i in range(M)]
for i in range(M):
    BC[i][0],BC[i][1] = map(int, input().split())


for i in range(M):
    A.sort()
    for j in range(BC[i][0]):
        if A[j] < BC[i][1]:
            A[j] = BC[i][1]
        else:
            break

print(sum(A))

### FIXED CODE ###

from collections import deque
import sys

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [[0] * 2 for i in range(M)]
for i in range(M):
    BC[i][0],BC[i][1] = map(int, input().split())

A.sort()
BC = sorted(BC, key=lambda x:x[1],reverse=True)

k = 0
for i in range(M):
    for j in range(BC[i][0]):
        
        if k >= N:
            print(sum(A))
            sys.exit()
        
        if A[k] < BC[i][1]:
            A[k] = BC[i][1]
            k += 1
        else:
            print(sum(A))
            sys.exit()

print(sum(A))
### BUGGY CODE ###

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

ans = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        if S[i] != S[j]:
            for k in range(j + 1, N):
                if (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]) and j - i != k - j:
                    ans += 1
                else:
                    continue
        else:
            continue

print(ans)

### FIXED CODE ###

# D - RGB Triplets

N = int(input())
S = input()
cnt_R = S.count('R')
cnt_G = S.count('G')
cnt_B = S.count('B')
total = cnt_R * cnt_G * cnt_B

expt = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = j + (j - i)
        if k < N and (S[i] != S[j] and S[j] != S[k] and S[i] != S[k]):
            expt += 1

print(total - expt)
### BUGGY CODE ###

import heapq
import copy

n = int(input())
a = []
b = []
flag = True

for _ in range(n):
	a_dash,b_dash = map(int,input().split())
	a.append(a_dash)
	b.append(b_dash)

t = 0
b2 = copy.deepcopy(b)
heapq.heapify(b2)

for i in range(n):
	minimum = heapq.heappop(b2)
	index = b.index(minimum)
	t += a[index]
	b[index] = -1
	if t > minimum:
		flag = False
		break

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


### FIXED CODE ###

import heapq
import copy
import bisect
from collections import deque

n = int(input())
a = []
b = []
tmp_a = []
tmp_b = []
flag = True

for _ in range(n):
	a_dash,b_dash = map(int,input().split())
	tmp_a.append(a_dash)
	tmp_b.append(b_dash)

k = zip(tmp_b,tmp_a)
sorted_k = sorted(k)
for b_dash,a_dash in sorted_k:
	a.append(a_dash)
	b.append(b_dash)

t = 0
qa = deque(a)
qb = deque(b)

for i in range(n):
	minimum_a = qa.popleft()
	minimum_b = qb.popleft()
	t += minimum_a
	if t > minimum_b:
		flag = False
		break

if flag:
	print('Yes')
else:
	print('No')
### BUGGY CODE ###

# coding: utf-8


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

    ans = 1
    for a in A:
        ans *= a
    
    return ans if ans <= 10**18 else -1


print(main())


### FIXED CODE ###

# coding: utf-8


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

    if 0 in A:
        return 0

    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            return -1
    
    return ans


print(main())
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count("AC"))

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
a=[0]*(n+10)
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        a[i]=a[i-1]+1
    else:
        a[i]=a[i-1]
for i in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])
### BUGGY CODE ###

from bisect import bisect

n = int(input())
lengths = map(int, input().split())

res = 0
sorted_lengths = sorted(lengths)
for i in reversed(range(n)):
	l1 = sorted_lengths[i]
	for j in reversed(range(1, i)):
		l2 = sorted_lengths[j]
		rem = sorted_lengths[:j]
		res += bisect(rem, l1 + l2) - bisect(rem, l1 - l2)

print(res)


### FIXED CODE ###

from bisect import bisect_left

n = int(input())
lengths = sorted(map(int, input().split()))

res = 0
for i in range(n):
	l1 = lengths[i]
	for j in range(i + 1, n - 1):
		l2 = lengths[j]
		res += bisect_left(lengths, l1 + l2, j + 1) - j - 1

print(res)
### BUGGY CODE ###

def func(a, b):
	return max(map(len, map(str, [a, b])))

N = int(input())

min_dig = 10 ** 18
for i in range(1, N + 1):
	if not N % i:
		j = N // i
		if j < i:
			break
		min_dig = min(min_dig, func(i, j))

print(min_dig)


### FIXED CODE ###

def func(a, b):
	return max(map(len, map(str, [a, b])))

N = int(input())

min_dig = 10 ** 18
for i in range(1, int(N ** 0.5) + 1):
	if not N % i:
		j = N // i
		min_dig = min(min_dig, func(i, j))

print(min_dig)
### BUGGY CODE ###

def query1(b):
    return not b

def query2(F, C, string, b):
    if (F == '1' and b) or (F == '2' and not b):
        return C + string
    else:
        return string + C

S = input()
Q = int(input())
r = True

for i in range(Q):
    Query = input().split()
    if len(Query) == 1:
        r = query1(r)
    else:
        S = query2(Query[1], Query[2], S, r)

if r:
    print(S)
else:
    print(S[::-1])

### FIXED CODE ###

start = []
end = []

def query1(b):
    return not b

def query2(F, C, string, b):
    if (F == '1' and b) or (F == '2' and not b):
        start.append(C)
        return C + string
    else:
        end.append(C)

S = input()
Q = int(input())
direction = True

for i in range(Q):
    Query = input().split()
    if len(Query) == 1:
        direction = query1(direction)
    else:
        query2(Query[1], Query[2], S, direction)

if direction:
    print(''.join(start[::-1]) + S + ''.join(end))
else:
    print(''.join(end[::-1]) + S[::-1] + ''.join(start))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

### FIXED CODE ###

import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)
### BUGGY CODE ###

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)
### BUGGY CODE ###

INF = float('inf')
d, g = map(int, input().split())
data = []
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in range(len(targets)):
    p, c, score, subtotal = data[targets[i]]
    t = (total + score - 1) // score
    if t < p and t < result:
      result = t
    t = p + f(data, total - subtotal, targets[0:i] + targets[i + 1:])
    if t < result:
      result = t
  return result
print(f(data, g, list(range(len(data)))))


### FIXED CODE ###

INF = float('inf')
d, g = map(int, input().split())
data = []
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in targets:
    score = data[i][2]
    t = (total + score - 1) // score
    if t < data[i][0] and t < result:
      result = t
  for i in range(len(targets)):
    j = targets[i]
    p, c, score, subtotal = data[j]
    t = p + f(data, total - subtotal, targets[0:i] + targets[i + 1:])
    if t < result:
      result = t
  return result
print(f(data, g, list(range(len(data)))))
### BUGGY CODE ###

from sys import stdin
N,M = map(int,input().split())
a = [int(stdin.readline()) for _ in range(M)]
A = [0]*(N+1)
mod = 1000000007
A[0] = 1
if not(1 in a):
  A[1] = 1
for i in range(2,N+1):
    if i in a:
      A[i] = 0
    else:
      A[i] = (A[i-2] + A[i-1]) % mod
print(A[N])


### FIXED CODE ###

N,M = map(int,input().split())
a = set(int(input()) for x in range(M))
A = [0]*(N+1)
mod = 1000000007
A[0] = 1
if not(1 in a):
  A[1] = 1
for i in range(2,N+1):
    if i in a:
      A[i] = 0
    else:
      A[i] = (A[i-2] + A[i-1]) % mod
print(A[N])
### BUGGY CODE ###

from collections import deque

MOD = 10 ** 9 + 7
ans = 1

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

if n == k:
    for x in a:
        ans *= x
    print(ans % MOD)
    exit()

p = []
m = []

for x in a:
    if x >= 0:
        p.append(x)
    else:
        m.append(x)

p.sort(reverse=True)
m.sort()

pos = deque(p)
neg = deque(m)

if len(p) == 0:
    for i in range(k):
        ans *= neg[-1]
        neg.pop()
    print(ans % MOD)
    exit()

while k > 1:
    if len(pos) >= 2 and len(neg) >= 2:
        if pos[0] * pos[1] > neg[0] * neg[1]:
            ans *= pos[0]
            pos.popleft()
            k -= 1
        else:
            ans *= neg[0] * neg[1]
            neg.popleft()
            neg.popleft()
            k -= 2
    elif len(pos) == 1 and len(neg) >= 2:
        if pos[0] > neg[0] * neg[1]:
            ans *= pos[0]
            pos.popleft()
            k -= 1
        else:
            ans *= neg[0] * neg[1]
            neg.popleft()
            neg.popleft()
            k -= 2
    else:
        ans *= pos[0]
        pos.popleft()
        k -= 1
if k == 1:
    ans *= pos[0]

print(ans % MOD)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7
ans = 1

#全部取る
if n == k:
    for x in a:
        ans *= x
        ans %= MOD
    print(ans % MOD)

#全部負かつ奇数個取る
elif max(a) < 0 and k % 2:
    a.sort()
    for i in range(1, k+1):
        ans *= a[-i]
        ans %= MOD
    print(ans % MOD)

else:
    pos = []
    neg = []
    
    for x in a:
        if x >= 0:
            pos.append(x)
        else:
            neg.append(x)
    
    pos.sort(reverse=True)
    neg.sort()
    
    
    if k % 2:
        ans *= pos.pop(0)
        k -= 1
     
    #2個ずつ取る
    num = []
    for x, y in zip(pos[::2], pos[1::2]):
        num.append(x * y)
    for x, y in zip(neg[::2], neg[1::2]):
        num.append(x * y)

    num.sort(reverse=True)

    for i in range(k // 2):
        ans *= num[i]
        ans %= MOD
    
    print(ans % MOD)
### BUGGY CODE ###

n = input()
n = int(n)

ret = 0

for i in range(n-1):
    ret += (i+1)

print(ret)


### FIXED CODE ###

n = input()
n = int(n)

max_value = n - 1

ret = max_value * (max_value + 1) // 2

print(ret)
### BUGGY CODE ###

from collections import deque
h , w , d = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
ans = [-1 for i in range(h*w + 1)]
for i in range(1,h*w+1):
    if ans[i] == -1:
        ans[i] = 0
        p = deque()
        flag = False
        for x in range(h):
            if flag:
                break
            for y in range(w):
                if a[x][y] == i:
                    p.append((i,x,y))
                    flag = True
                    break
        while p:
            now , nowx , nowy = p.popleft()
            flag = False
            if now + d > h*w:
                break
            for nexx in range(h):
                if flag:
                    break
                for nexy in range(w):
                    if a[nexx][nexy] == now + d:
                        p.append((now+d,nexx,nexy))
                        ans[now+d] = ans[now] + abs(nowx-nexx) + abs(nowy-nexy)
                        flag = True
                        break 

    else:
        continue

q = int(input())
for i in range(q):
    l , r = map(int,input().split())
    print(ans[r]-ans[l])

### FIXED CODE ###

from collections import deque
h , w , d = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
zahyo = [-1 for i in range(h*w+1)]
for i in range(h):
    for j in range(w):
        zahyo[a[i][j]] = (a[i][j],i,j)
ans = [-1 for i in range(h*w + 1)]
for i in range(1,h*w+1):
    if ans[i] == -1:
        ans[i] = 0
        p = deque()
        p.append(zahyo[i])
        while p:
            now , nowx , nowy = p.popleft()
            if now + d > h*w:
                break
            tugi , nexx , nexy = zahyo[now+d]
            p.append(zahyo[now+d])
            ans[tugi] = ans[now] + abs(nowx-nexx) + abs(nowy-nexy)

    else:
        continue

q = int(input())
for i in range(q):
    l , r = map(int,input().split())
    print(ans[r]-ans[l])
### BUGGY CODE ###

from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [[False]*(N+1) for _ in range(N+1)]
for i in friend:
    f[i[0]][i[1]] = True
    f[i[1]][i[0]] = True

b = [[False]*(N+1) for _ in range(N+1)]
for i in block:
    b[i[0]][i[1]] = True
    b[i[1]][i[0]] = True
    
stack=deque()
linkList = []
ans = []
visited = [0] * (N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    cnt = 0
    link = [i]
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in range(i,N+1):
            if f[n][j] and visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.append(j)
    linkList.append(link)

for i in range(1,N+1):
    #連結成分のサイズ
    linkSize = 0
    #「友達関係」または「ブロック関係」はマイナスする
    minus = 0
    for link in linkList:
        if not i in link:
            continue
        for j in link:
            linkSize = len(link)
            if f[i][j] or b[i][j]:
                minus += 1
    ans.append(linkSize-minus-1)

print(*ans)
    

### FIXED CODE ###

from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [set() for _ in range(N+1)]
b = [set() for _ in range(N+1)]

for i,j in friend:
    f[i].add(j)
    f[j].add(i)
for i,j in block:
    b[i].add(j)
    b[j].add(i)

stack=deque()
linkList = []
ans = [0] *(N+1)
visited = [0] * (N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    link = {i}
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in f[n]:
            if j in f[n] and visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.add(j)
    linkList.append(link)
    for i in link:
        ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])
### BUGGY CODE ###

import numpy as np

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

for i in range(N):
    y = X[:i] + X[i + 1:]
    print(int(np.median(y)))


### FIXED CODE ###

import numpy as np

N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
x = np.median(X)
index = N // 2
m1 = Y[index]
m2 = Y[index - 1]

for i in range(N):
    if X[i] < x:
        print(m1)
    else:
        print(m2)
### BUGGY CODE ###

import sys

def main():
    input = sys.stdin.readline
    
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    result = list()

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    print(len(set(result)))
'''
    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline

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

    #result = list()

    minimum = P[0]
    count = 1
    for i in range(N):
        if(minimum > P[i]):
            minimum = P[i]
            count += 1
    print(count)
#        Pj = list(P[j] for j in range(i+1))
        #print(Pj)
        #Pj = P[0:i+1]
#        min_P = min(Pj)
#        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    '''
    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import itertools

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

mod = 10**9 + 7

ans = 0
for v in itertools.combinations(a,2):
    ans += (v[0] * v[1])%mod

print(ans%mod)

### FIXED CODE ###

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

mod = 10**9 + 7

sum_a = sum(a)%mod
ans = 0
for i in range(n-1):
    sum_a -= a[i]
    ans += (a[i]*sum_a)%mod

print(ans%mod)