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

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

K = int(input())
""" answer 1
ans = 0
tmp = {}
for i in range(201):
    tmp[i] = 0

for i in range(1, K +1):
    for j in range(1, K +1):
        tmp[math.gcd(i, j)] += 1

for k in range(1, K +1):
    for key in tmp.keys():
        ans += math.gcd(key, k) * tmp[key]
print(ans)

"""

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K +1):
            ans += math.gcd(math.gcd(i,j), k)
print(ans)

### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

K = int(input())


ans = 0

tmp = {}
for i in range(201):
    tmp[i] = 0

for i in range(1, K +1):
    for j in range(1, K +1):
        tmp[math.gcd(i, j)] += 1

for k in range(1, K +1):
    for key in tmp.keys():
        ans += math.gcd(key, k) * tmp[key]
print(ans)

"""
K = 3

1 1 1  1
1 1 2  1
1 1 3  1
1 2 1  1
1 2 2  1
1 2 3  1
2 1 1  1
2 1 2  1
2 1 3  1
3 1 1  1
3 1 2  1
3 1 3  1
3 2 1  1
3 2 2  1
3 2 3  1
3 3 1  1
3 3 2  1
3 3 3  3

"""
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000)
def l_burger(l):
    if l == 0:
        return 'P'
    return 'B' + l_burger(l-1) + 'P' + l_burger(l-1) + 'B'
n, x = map(int, input().split())
cnt = 0
for i in l_burger(n)[:x]:
    if i == 'P':
        cnt += 1
        
print(cnt)

### FIXED CODE ###

N, X = map(int, input().split())
a = [1] * (N+1)
p = [1] * (N+1)
for i in range(1,N+1):
    a[i] = a[i-1]*2 + 3
    p[i] = p[i-1]*2 + 1
def f(n, x):
    if n == 0:
        return 1
    elif x == 1:
        return 0
    elif 2<= x <= a[n-1] + 1:
        return f(n-1, x-1)
    elif x == a[n-1] + 2:
        return p[n-1] + 1
    elif a[n-1]+3 <= x <= 2*a[n-1]+2:
        return p[n-1]+1+ f(n-1, x-(a[n-1]+2))
    elif x == 2*a[n-1]+3:
        return p[n]
print(f(N,X))
### BUGGY CODE ###

import numpy as np

s = input()
p = np.array([0]*13)
p[0] = 1

for si in range(len(s)):
  a = np.array([0]*13)
  if s[si] == '?':
    for j in range(10):
      for i in range(13):
        a[(i*10+j)%13] += p[i]
  else:
    c = int(s[si])
    for i in range(13):
      a[(i*10+c)%13] += p[i]
  for i in range(13):
    p[i] = a[i]%1000000007
print(p[5])

### FIXED CODE ###

import numpy as np

s = input()
p = np.array([0]*13)
p[0] = 1

amari = [[0]*13 for _ in range(13)]
for j in range(10):
  for i in range(13):
    amari[i][(i*10+j)%13] += 1
M = np.array(amari)

for si in range(len(s)):
  a = np.array([0]*13)
  if s[si] == '?':
    a = np.dot(p,M)
  else:
    c = int(s[si])
    for i in range(13):
      a[(i*10+c)%13] += p[i]
  p = np.mod(a,1000000007)
print(p[5])
### BUGGY CODE ###

s = input()
slen = len(s)
while(1):
  sub = s
  s = s.replace("01","")
  s = s.replace("10","")
  if sub == s:
    break
print(slen-len(s))

### FIXED CODE ###

s = input()
print(2*min(s.count("0"),s.count("1")))
### BUGGY CODE ###

n=int(input())
d=[0]*(n+1)
prime=[True]*(n+1)
prime[0]=False
prime[1]=False
for i in range(2,int(n**0.5)+1):
  if prime[i]:
    for j in range(i*2,n+1,i):
      prime[j]=False
      d[j]=i
s=[i for i in range(n+1) if prime[i]]
for ss in s:
  d[ss]=ss
cnt=[[] for _ in range(n+1)]
for i in range(2,n):
  c=[]
  i2=i
  while i>1:
    c.append(d[i])
    i=i//d[i]
  cnt[i2]=c

ans=0
from collections import Counter
for c in cnt:
  cc=Counter(c)
  cv=cc.values()
  a=1
  for ccc in cv:
    a*=(ccc+1)
  if a!=1:
    ans+=a
print(ans+1)


### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n):
  ans+=int((n-1)/i)
print(ans)
### BUGGY CODE ###

import sys
L = []
for l in sys.stdin:
  L.append(l)
N = int(L[0])
A = list(map(int, L[1].split()))

answer = 1
for a in A:
  answer = answer * a
if answer <= 1000000000000000000:
  print(answer)
else:
  print(-1)

### FIXED CODE ###

import sys

L = []
for l in sys.stdin:
  L.append(l) 
A = list(map(int, L[1].split()))

if 0 in A:
  print(0)
else:
  answer = 1
  for a in A:
    answer = answer * a
    if answer > 1000000000000000000:
      print(-1)
      break
  if answer <= 1000000000000000000:
    print(answer)
### BUGGY CODE ###

import sys

L,R = list(map(int,input().split()))
ans = 2019

if R <= 45:
    print(R*(R-1))
    sys.exit()
else:
    for i in range(L,R):
        for v in range(i+1,R+1):
            a = (i*v)%2019
            ans = min(ans,a)
            if a == 0:
                break
print(ans)

### FIXED CODE ###

import sys

L,R = list(map(int,input().split()))
ans = 2019

for i in range(L,R):
    for v in range(i+1,R+1):
        a = (i*v)%2019
        ans = min(ans,a)
        if a == 0:
            break
    else:
        continue
    break
print(ans)
### BUGGY CODE ###

from collections import deque
import math

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

    A.sort()

    Amax=max(A)

    dp=[0]*Amax

    tmp=-1
    res=0
    for i in range(len(A)):
        a=A.pop(0)
        if a==tmp:
            continue
        if dp[a-1]==0:
            if len(A)>0:
                if A[0]!=a:
                    res+=1
            else:
                res+=1
            m=2
            while (a*m)<=Amax:
                dp[a*m-1]=1
                m+=1
        tmp=a

    print(res)
if __name__=="__main__":
    main()

### FIXED CODE ###

from collections import deque
import math

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

    A.sort(reverse=True)

    Amax=max(A)

    dp=[0]*Amax

    tmp=-1
    res=0
    for i in range(len(A)):
        a=A.pop()
        if a==tmp:
            continue
        if dp[a-1]==0:
            if len(A)>0:
                if A[len(A)-1]!=a:
                    res+=1
            else:
                res+=1
            m=2
            while (a*m)<=Amax:
                dp[a*m-1]=1
                m+=1
        tmp=a

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

n = int(input())
s = input()
r = []
g = []
b = []
for i in range(n):
	if s[i] == "R":
		r.append(i)
	elif s[i] == "G":
		g.append(i)
	else:
		b.append(i)
count = 0
unchi = b
for i in r:
	for j in g:
		u = abs(i-j)
		count += [0,1][(max(i,j)+u) in unchi] + [0,1][(min(i,j)-u) in unchi] + [0,1][u%2 == 0 and (i+j)//2 in unchi]
print(len(r)*len(g)*len(b)-count)

### FIXED CODE ###

from collections import Counter
# これは, u749194f さんの改造です。
# オリジナルではございません。
# https://atcoder.jp/contests/abc162/submissions/11825963
n = int(input())
s = input()
flag = True
if len(set(s))<=2:
    print(0)
    flag = False
if flag:
    r = [i+1 for i in range(n) if s[i]=='R']
    b = [i+1 for i in range(n) if s[i]=='B']
    g = [i+1 for i in range(n) if s[i]=='G']
    minus = 0
    def cnt_cmb(a, b, c):
        cnt = 0
        set_c = set(c)
        for i in a:
            for j in b:
                if (i+j)/2 in set_c:
                    cnt += 1
        return cnt
    minus += cnt_cmb(r, b, g)
    minus += cnt_cmb(b, g, r)
    minus += cnt_cmb(g, r, b)
    a = Counter(s)
    rslt = 1
    for value in a.values():
        rslt *= value
    print(len(r)*len(b)*len(g)-minus)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    from collections import deque

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

    distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
    check = [[1] * n for i in range(n)]
    p = [((i - 1) // n, (i - 1) % n) for i in p]
    ans = 0
    for i, j in p:
        ans += distance[j][i]
        d = deque()
        d.append((j, i, distance[j][i]))
        check[j][i] = 0
        while len(d):
            x, y, dis = d.popleft()
            for i in range(0, 4):
                nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

                if 0 <= nx < n and 0 <= ny < n:
                    # 更新できるマスは更新
                    if distance[nx][ny] > dis:
                        distance[nx][ny] = dis
                        d.append((nx, ny, dis + check[nx][ny]))

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]

def move(x,y,nx,ny):
    if distance[nx][ny] > distance[x][y] + check[x][y]:
        distance[nx][ny] = distance[x][y] + check[x][y]
        d.append((nx,ny))

ans = 0
for i, j in p:
    ans += distance[j][i]
    d=[]
    d.append((j,i))
    check[j][i] = 0
    while len(d):
        x, y = d.pop()
        if x!=0:
            move(x,y,x-1,y)
        if x!=n-1:
            move(x,y,x+1,y)
        if y!=0:
            move(x,y,x,y-1)
        if y!=n-1:
            move(x,y,x,y+1)

print(ans)
### BUGGY CODE ###

import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    s = ns()
    Q = ni()

    T1 = 0
    FrontS = ""
    BackS = ""
    for _ in range(Q):
        T = stdin.readline().split()
        if T[0] == "1":
            T1 += 1
        else:
            if T1 % 2 == 0:
                # これは元通り
                
                s = FrontS + s + BackS
                FrontS = ""
                BackS = ""

                if T[1] == "1":
                    FrontS = T[2] + FrontS
                else:
                    BackS += T[2]
            else:
                # これは逆向き

                s = FrontS + s + BackS
                FrontS = ""
                BackS = ""
                
                if T[1] == "1":
                    BackS = T[2] + BackS
                else:
                    FrontS = T[2] + FrontS
    
    if BackS != "":
        s += BackS
    if FrontS != "":
        s = FrontS + s

    if T1 % 2 == 0:
        print(s)
    else:
        print(s[::-1])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    s = ns()
    Q = ni()

    T1 = 0
    FrontS = ""
    BackS = ""
    for _ in range(Q):
        T = stdin.readline().split()
        if T[0] == "1":
            FrontS, BackS = BackS, FrontS
            T1 += 1
        else:
            if T[1] == "1":
                FrontS += T[2]
            else:
                BackS += T[2]
                
    FrontS = FrontS[::-1]

    if T1 % 2 == 0:
        print(FrontS + s + BackS)
    else:
        print(FrontS + s[::-1] + BackS)

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

H,W,D=list(map(int,input().split()))
arr=[0 for i in range(H*W+1)]
for y in range(H):
    for x,n in enumerate(map(int,input().split())):
        arr[n]=[x,y]

dic={}

Q=int(input())
for i in range(Q):
    ans=0
    now,goal= list(map(int,input().split()))
    nx=arr[now][0]
    ny=arr[now][1]
    if dic.get(now*H*W+goal,0)!=0:
        print(ans)
        continue
    for j in range((goal-now)//D):
        now+=D
        x=arr[now][0]
        y=arr[now][1]
        ans+=abs(x-nx)+abs(y-ny)
        nx=x
        ny=y
    dic[now*H*W+goal]=ans
    print(ans)

### FIXED CODE ###

H,W,D=list(map(int,input().split()))
map_=[[0,0] for _ in range(H*W+1)]
for y in range(H):
    for x,A in enumerate(map(int,input().split())):
        map_[A]=[x+1,y+1]

cost=[0 for _ in range(H*W+1)]
for i in range(D+1,H*W+1):
    cost[i]+=abs(map_[i][0]-map_[i-D][0])+abs(map_[i][1]-map_[i-D][1])+cost[i-D]
Q=int(input())
for i in range(Q):
    L,R=list(map(int,input().split()))
    print(cost[R]-cost[L])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
B = 1
for i in A:
    B *= i
if B > 10 ** 18:
    print(-1)
else:
    print(B)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = 1
# print(max(A))
if 0 in A:
    print(0)
elif max(A) > 10**18:
    print(-1)
else:
    for i in A:
        B *= i
        if B > 10 ** 18:
            B = -1
            break
    print(B)
### BUGGY CODE ###

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

S = 1
for i in range(N):
    S = S*A[i]

if S > 10 ** 18:
    print(-1)
else:
    print(S)

### FIXED CODE ###

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

    if 0 in A:
        print(0)
        return

    S = 1
    for i in range(N):
        S *= A[i]
        if S > 10 ** 18:
            print(-1)
            return

    print(S)

main()
### BUGGY CODE ###

N,M = map(int,input().split())
P = list(map(int,input().split()))
L = [set(map(int,input().split())) for i in [None]*M]

LSET = L[:]
loop = True
while loop:
    loop = False
    LSET2 = []
    i = 0
    while i < len(LSET):
        j = i + 1
        tmp = LSET[i]
        if not tmp:
            i += 1
            continue
        while j < len(LSET):
            if  LSET[j] and not LSET[i].isdisjoint(LSET[j]):
                tmp |= LSET[j]
                loop = True
                LSET[j] = None
            j += 1
        LSET2.append(tmp)
        i += 1
    LSET = LSET2[:]

result = len([i for i in set(range(1,N+1)).difference(*LSET) if i == P[i-1]])
PSET = [{P[i-1] for i in s}for s in LSET]
LPSET = [l&p for l,p in zip(LSET,PSET)]
result += sum([len(i)for i in LPSET])
print(result)

### FIXED CODE ###

class UnionFind:
    def __init__(self,size):
        self.L = [{'parent':i,'rank':0} for i in range(size)]

    def find(self,x):
        if self.L[x]['parent'] != x:
            self.L[x]['parent'] = self.find(self.L[x]['parent'])
        return self.L[x]['parent']

    def union(self,x,y):
        x_root = self.find(x)
        y_root = self.find(y)
        if x_root == y_root:
            return
        if self.L[x_root]['rank'] < self.L[y_root]['rank']:
            x_root,y_root = y_root,x_root

        self.L[y_root]['parent'] = x_root
        if self.L[x_root]['rank'] == self.L[y_root]['rank']:
            self.L[x_root]['rank'] += 1
    
    def __str__(self):
        return str([i['parent'] for i in self.L])

if __name__ == '__main__':
    N,M = map(int,input().split())
    P = list(map(int,input().split()))
    graph = UnionFind(N)
    for i in [None]*M:
        x,y = map(int,input().split())
        graph.union(x-1,y-1)
    count = 0
    for i,v in enumerate(P):
        if graph.find(i) == graph.find(v-1):
            count += 1
    print(count)
### BUGGY CODE ###

import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()
    Q = get_input(int)
    for _ in range(Q):
        query = get_input()
        if query[0] == "1":
            S = S[::-1]
        else:
            _, F, C = query.split(" ")
            if F == "1":
                S = C + S
            else:
                S = S + C
    print(S)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()
    Q = get_input(int)

    # NOTE: need to reverse
    heads = ""
    tails = ""
    direction = 1
    for _ in range(Q):
        query = get_input()
        if query[0] == "1":
            direction *= -1
        else:
            _, F, C = query.split(" ")
            if F == "1":
                if direction == 1:
                    heads += C
                else:
                    tails += C
            else:
                if direction == 1:
                    tails += C
                else:
                    heads += C
     
    if direction == 1:
        print(heads[::-1] + S + tails)
    else:
        print(tails[::-1] + S[::-1] + heads)


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

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

# 最長共通接頭辞問題(Z-Algorithm)
# 文字列SとS[i:]の最長共通接頭辞を各iについて求める
# 参考：https://codeforces.com/blog/entry/3107
# 図がわかりやすい:https://snuke.hatenablog.com/entry/2014/12/03/214243


def Z_Algorithm(S):
    N = len(S)
    R = 0 # Rはi文字目まで読んだ時、接頭辞の右端のうち一番右側にくるようなもの
    L = 0 # Lはその範囲の左端
    Z = [0 for _ in range(N)] # 答えとなる最長接頭辞の長さ
    Z[0] = N

    for i in range(1, N):
        if i > R:
            # iが前のRより右側ならS[i:]とSのみで考える
            L = i
            R = i
            while (R < N and S[R-L] == S[R]):
                R += 1
            Z[i] = R - L
            R -= 1
        else:
            k = i - L
            if Z[k] < R - i + 1:
                # はみ出さないなら前のがそのまま使える。R,Lはそのまま
                Z[i] = Z[k]
            else:
                # はみ出したら伸ばしてく
                L = i
                while (R < N and S[R-L] == S[R]):
                    R += 1
                Z[i] = R - L
                R -= 1
    return Z

ans = 0
for i in range(N):
    Z = Z_Algorithm(S[i:])
    for j, z in enumerate(Z):
        ans = max(ans, min(z, j))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

# 最長共通接頭辞問題(Z-Algorithm)
# 文字列SとS[i:]の最長共通接頭辞を各iについて求める
# 参考：https://codeforces.com/blog/entry/3107
# 図がわかりやすい:https://snuke.hatenablog.com/entry/2014/12/03/214243


def Z_Algorithm(S):
    N = len(S)
    R = 0 # Rはi文字目まで読んだ時、接頭辞の右端のうち一番右側にくるようなもの
    L = 0 # Lはその範囲の左端
    Z = [0 for _ in range(N)] # 答えとなる最長接頭辞の長さ
    Z[0] = N

    for i in range(1, N):
        if i > R:
            # iが前のRより右側ならS[i:]とSのみで考える
            L = i
            R = i
            while (R < N and S[R-L] == S[R]):
                R += 1
            Z[i] = R - L
            R -= 1
        else:
            k = i - L
            if Z[k] < R - i + 1:
                # はみ出さないなら前のがそのまま使える。R,Lはそのまま
                Z[i] = Z[k]
            else:
                # はみ出したら伸ばしてく
                L = i
                while (R < N and S[R-L] == S[R]):
                    R += 1
                Z[i] = R - L
                R -= 1
    return Z


def main():
    ans = 0
    for i in range(N):
        Z = Z_Algorithm(S[i:])
        for j, z in enumerate(Z):
            ans = max(ans, min(z, j))
    print(ans)


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

from collections import deque
from collections import Counter
n,x,y = map(int, input().split())
x-=1
y-=1

dis=[['NONE']*n for i in range(n)]
d = deque()
for i in range(n):
    d.append((i,0))
    c=0
    while d:
        p,j=d.popleft()
        if p==x and c==0:
            d.append((y,j+1))
            c=1
        if p==y and c==0:
            d.append((x,j+1))
            c=1
        if dis[i][p]=='NONE':
            dis[i][p]=j
            if p+1<n:
                if dis[i][p+1]=='NONE':
                    d.append((p+1,j+1))
            if p-1>=0:
                if dis[i][p-1]=='NONE':
                    d.append((p-1,j+1))
s=[]
for i in dis:
    s+=i
c=Counter(s)
for i in range(1,n):
    print(c[i]//2)


### FIXED CODE ###

from collections import Counter
n,x,y = map(int, input().split())
x-=1
y-=1

dis=[]

for i in range(n-1):
    for j in range(i,n):
        dis.append(min(abs(i-j),abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1))
c=Counter(dis)
for i in range(1,n):
    print(c[i])
### BUGGY CODE ###

N = int(input())
T = 0
A = 0
for _ in range(N):
    t, a = map(int, input().split())
    i = 1
    while T > i*t or A > i*a:
        i += 1
    T = i*t
    A = i*a
    
print(T+A)

### FIXED CODE ###

N = int(input())
T = 0
A = 0
for _ in range(N):
    t, a = map(int, input().split())
    i = max(T//t, A//a, 1)
    while T > i*t or A > i*a:
        i += 1
    T = i*t
    A = i*a
    
print(T+A)
### BUGGY CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
sm = 0

for i in xrange(0, len(a)):
	for j in xrange(i+1, len(a)):
		if a[i] > a[j]:
			temp = a[i]
			a[i] = a[j]
			a[j] = temp
	sm = sm + a[i]


print a[0], a[len(a)-1], sm

### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())

a_ = sorted(a)
sum = 0

for e in a_:
	sum += e

print "%d %d %d" %(a_[0], a_[-1], sum)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(20000)
def getMax(d,n,c):
    global bs
    if len(d[n])==0:
        bs=max(bs,c)

    for k in d[n]:
        getMax(d,k,c+1)

n,m=map(int,input().split())
d={}
for j in range(1,n+1):
    d[j]=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a].append(b)
bs=-1
for i in range(1,n+1):
    c=0
    getMax(d,i,c)
print(bs)


### FIXED CODE ###

import sys

sys.setrecursionlimit(20000)


def getMax(d, n):
    if len(d[n]) == 0:
        return 0
    if not dp[n] == -1:
      
        return dp[n]
    for k in d[n]:
        dp[n] = max(dp[n], 1 + getMax(d, k))
    return dp[n]


n, m = map(int, input().split())
d = {}
dp = [-1 for _ in range(n + 1)]
for j in range(1, n + 1):
    d[j] = []
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
bs = -1
for i in range(1, n + 1):
    bs = max(bs, getMax(d,i))
print(bs)
### BUGGY CODE ###

def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline

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

    ans = 0
    A.sort(reverse=True)
    c = Counter(A)

    for b in A:
        a = (1 << b.bit_length()) - b
        if a == b:
            ans += c[b]//2
            c[b] %= 2
        else:
            if a in c.keys():
                cur = min(c[a], c[b])
                ans += cur
                c[b] -= cur
                c[a] -= cur
        # print(a, b, c, ans)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline

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

    ans = 0
    A.sort(reverse=True)
    c = Counter(A)

    for b in A:
        if c[b] == 0:
            continue
        a = (2 ** b.bit_length()) - b
        if a == b:
            cur = c[b]//2
        else:
            cur = min(c[a], c[b])
        ans += cur
        c[b] -= cur
        c[a] -= cur
        # print(a, b, c, ans)

    print(ans)


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

N = int(input())
P = list(map(int, input().split()))
s = 0
for i in range(N):
    if P[i] == min(P[0:i+1]):
        s += 1
print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
s = 0
P = (A[0:N])
Q = A
for i in range(N-1):
    if Q[i] < Q[i+1]:
        Q[i+1] = Q[i]
for i in range(N):
    if P[i] == Q[i]:
        s += 1
print(s)