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

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

    h, w, n = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    ab_d = {a*(10**9)+b-1 for a, b in ab}

    ans = [set() for _ in range(9)]
    for a, b in ab:
        temp = [None for _ in [0]*25]
        for i in range(max(0, 3-a), min(5, h-a+3)):
            for j in range(max(0, 3-b), min(5, w-b+3)):
                if (a+i-2)*(10**9)+b+j-3 in ab_d:
                    temp[i*5+j] = 1
                else:
                    temp[i*5+j] = 0
        for i in range(3):
            for j in range(3):
                cnt = [temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
                if None not in cnt:
                    ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)

    for i in range(9):
        ans[i] = len(ans[i])

    print((h-2)*(w-2)-sum(ans))
    for i in ans:
        print(i)


main()

### FIXED CODE ###

h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*n]
ab_d={a*(10**9)+b-1 for a,b in ab}

ans=[set() for _ in range(9)]
for a,b in ab:
    temp=[None for _ in [0]*25]
    for i in range(5):
        for j in range(5):
            if 0<a+i-2<=h and 0<b+j-2<=w:
                if (a+i-2)*(10**9)+b+j-3 in ab_d:
                    temp[i*5+j]=1
                else:
                    temp[i*5+j]=0
    for i in range(3):
        for j in range(3):
            cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
            if None not in cnt:
                ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)
                
for i in range(9):
    ans[i]=len(ans[i])

print((h-2)*(w-2)-sum(ans))
for i in ans:
    print(i)
### BUGGY CODE ###

n = int(input())
lst = list(map(int, input().split()))
lst.append(0)
lst.insert(0, 0)

dist = []
for i in range(n+1):
  dist.append(abs(lst[i+1]-lst[i]))

for i in range(n):
  ans = sum(dist)-(dist[i]+dist[i+1])
  ans += abs(lst[i]-lst[i+2])
  print(ans)
  

### FIXED CODE ###

n = int(input())
lst = list(map(int, input().split()))
lst.append(0)
lst.insert(0, 0)

dist = []
for i in range(n+1):
  dist.append(abs(lst[i+1]-lst[i]))

sum_dist = sum(dist)
for i in range(n):
  ans = sum_dist-(dist[i]+dist[i+1])
  ans += abs(lst[i]-lst[i+2])
  print(ans)
### BUGGY CODE ###

N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()), reverse=True)

cnt = 0
for i in range(N):
    if C[i] <= B[0]:
        break
    for j in range(N):
        if C[i] > B[j]:
            for k in range(N):
                if B[j] > A[k]:
                    cnt+= 1
                else:
                    break
        else:
            break
print(cnt)


### FIXED CODE ###

from  bisect import bisect_left, bisect_right

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

cnt = 0
for b in B:
    a_cnt = bisect_left(A, b)
    c_cnt = N - bisect_right(C, b)
    cnt += a_cnt * c_cnt
print(cnt)
### BUGGY CODE ###

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

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

max_len = len(bin(max(a))[2:])
l = [0] * max_len

for a in a:
    temp = bin(a)[2:][::-1]
    # print(temp)
    for i in range(max_len):
        if i < len(temp):
            l[i] += int(temp[i])
        else:
            l[i] += 0

# print(l)

ans = 0
mod = 10**9 + 7

for i in range(max_len):
    ans += pow(2, i, mod) * l[i] * (N-l[i])
    ans = ans % mod

print(ans)


### FIXED CODE ###

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

max_len = len(bin(max(a))[2:])
l = [0] * max_len

ans = 0
mod = 10**9 + 7

for i in range(max_len):
    for x in a:
        l[i] += x >> i & 1
    ans += pow(2, i, mod) * l[i] * (N-l[i])

print(ans % mod)
### BUGGY CODE ###

# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
S = read()[:-1]


def permutation_3to2(new3num: str):
    return (new3num[1:], new3num[0] + new3num[2])


passes = set()
set_2num = set()
passes.add(S[:3])
set_2num.add(S[:2])
tmp1, tmp2 = permutation_3to2(S[:3])
set_2num.add(tmp1)
set_2num.add(tmp2)
for c in S[3:]:
    for a, b in list(set_2num):
        tmp = a + b + c
        tmp1, tmp2 = permutation_3to2(tmp)
        set_2num.add(tmp1)
        set_2num.add(tmp2)
        passes.add(tmp)

print(len(passes))


### FIXED CODE ###

# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
S = read()[:-1]


def permutation_3to2(new3num: str):
    return (new3num[1:], new3num[0] + new3num[2])


passes = set()
set_2num = set()
passes.add(S[:3])
set_2num.add(S[:2])
tmp1, tmp2 = permutation_3to2(S[:3])
set_2num.add(tmp1)
set_2num.add(tmp2)
for c in S[3:]:
    for a, b in list(set_2num):
        tmp = a + b + c
        tmp1, tmp2 = permutation_3to2(tmp)
        set_2num.add(tmp1)
        set_2num.add(tmp2)
        passes.add(tmp)

print(len(passes))
### 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)

t=0
for i in range(len(r)):
    for j in range(len(g)):
        p=0
        for k in range(len(b)):
            if p<3:
                if abs(r[i]-g[j])!=abs(b[k]-g[j]) and abs(r[i]-b[k])!=abs(b[k]-g[j]) and abs(r[i]-g[j])!=abs(b[k]-r[i]):
                    t=t+1
                else:
                    p+=1
            else:
                t = t + 1
print(t)

### FIXED CODE ###

N= int(input())
S=input()
r=[]
g=[]
b=[]
A=0
B=0
C=0
for i in range(N):
    if S[i]=="R":
        r.append(i)
        A+=1
    elif S[i]=="G":
        g.append(i)
        B+=1
    else:
        b.append(i)
        C+=1
k=0
for i in range(N-2):
    for j in range(i+1,N-1):
        t=2*j-i
        if t<N:
            if S[i]!=S[j] and S[i]!=S[t] and S[t]!=S[j] :
                k+=1

print(A*B*C-k)
### BUGGY CODE ###

from heapq import heappop, heappush

N, M, S, T = map(int, input().split())

GA = [[] for _ in range(N+1)]
GB = [[] for _ in range(N+1)]

for _ in range(M):
    u, v, a, b = map(int, input().split())
    GA[u].append([v, a])
    GA[v].append([u, a])
    GB[v].append([u, b])
    GB[u].append([v, b])

costa = [10**16]*(N+1)
costb = [10**16]*(N+1)

costa[S] = 0
costb[T] = 0
Q = [[0, S]]


while Q:
    c, p = heappop(Q)
    if costa[p] < c:
        continue

    for q, a in GA[p]:
        if costa[q] > c+a:
            costa[q] = c+a
            heappush(Q, [c+a, q])

Q = [[0, T]]

while Q:
    c, p = heappop(Q)
    if costb[p] < c:
        continue

    for q, b in GB[p]:
        if costb[q] > c+b:
            costb[q] = c+b
            heappush(Q, [c+b, q])

ans = []
tmp = 10**16

for i in range(N, -1, -1):
    
    tmp = min(tmp, costa[i] + costb[i])
    ans.append(10**15 - tmp)

print(*ans[::-1][1:], sep="\n")

### FIXED CODE ###

from heapq import heappop, heappush

N, M, S, T = map(int, input().split())

GA = [[] for _ in range(N+1)]
GB = [[] for _ in range(N+1)]

for _ in range(M):
    u, v, a, b = map(int, input().split())
    GA[u].append([v, a])
    GA[v].append([u, a])
    GB[v].append([u, b])
    GB[u].append([v, b])

costa = [10**16]*(N+1)
costb = [10**16]*(N+1)

costa[S] = 0
costb[T] = 0
Q = [[0, S]]


while Q:
    c, p = heappop(Q)
    if costa[p] < c:
        continue

    for q, a in GA[p]:
        if costa[q] > c+a:
            costa[q] = c+a
            heappush(Q, [c+a, q])

Q = [[0, T]]

while Q:
    c, p = heappop(Q)
    if costb[p] < c:
        continue

    for q, b in GB[p]:
        if costb[q] > c+b:
            costb[q] = c+b
            heappush(Q, [c+b, q])

ans = []
tmp = 10**16

for i in range(N, -1, -1):
    
    tmp = min(tmp, costa[i] + costb[i])
    ans.append(10**15 - tmp)

print(*ans[::-1][1:], sep="\n")
### BUGGY CODE ###

k,s = map(int,input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        for t in range(k+1):
            if (i+j+t) == s:
                count += 1
                break

print(count)

### FIXED CODE ###

k,s = map(int,input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            count += 1

print(count)
### BUGGY CODE ###

from collections import*
h,w,d=map(int,input().split())
g=defaultdict(tuple)
for i in range(h):
    tmp=[]
    for j,v in enumerate(map(int,input().split())):
        g[v]=(i,j)
q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    for j in range(l,r-d+1,d):
        ans+=sum(abs(s-t)for s,t in zip(g[j],g[j+d]))
    print(ans)


### FIXED CODE ###

from itertools import*
from collections import*
h,w,d=map(int,input().split())
g=defaultdict(tuple)
f=defaultdict(int)
for i in range(h):
    for j,v in enumerate(map(int,input().split())):
        g[v]=(i,j)
        
q=int(input())

for i in range(1,d+1):
    for k,v in enumerate(accumulate([0]+[sum(abs(s-t)for s,t in zip(g[j+d],g[j]))for j in range(i,h*w+1-d,d)])):
        f[i+k*d]=v
        
for i in range(q):
    l,r=map(int,input().split())
    print(f[r]-f[l])
### BUGGY CODE ###

# encoding: "utf-8"

class Stdin:
    @staticmethod
    def read_line(converter=str):
        return [converter(x) for x in input().split()]
    
    @staticmethod
    def read_lines(n, converter=str):
        result = list()
        for _ in range(n):
            result.append(Stdin.read_line(converter))
        return result
    
    @staticmethod
    def convert(data, converter):
        assert(len(data) == len(converter))
        return tuple(map(lambda x, f: f(x), data, converter))

    @staticmethod
    def convert_lines(datas, n, converter):
        return [converter(data, n, converter) for data in datas]


def first_count_and_pop(xs):
    cnt = 0
    fst = xs[0]
    # cnt = xs.count(fst)
    for x in xs:
        if x != fst:
            break
        cnt += 1
    return (cnt, xs[cnt:])    
    

def main_deprecated():
    _ = input()
    xs = Stdin.read_line(converter=int)
    xs.sort()
    ys = dict()
    while xs:
        key = xs[0]
        cnt, xs = first_count_and_pop(xs)
        ys[key] = cnt
    # zs = sorted(list(ys.items()), key=(lambda x: x[1]), reverse=True)
    m = 0
    for i in range(0, 100002):
        temp = ys.get(i-1, 0) + ys.get(i, 0) + ys.get(i+1, 0)
        if m < temp:
            m = temp
    print(m)

def main():
    input()
    xs = Stdin.read_line(converter=int)
    xs.sort()
    counts = list()
    for i in range(100000):
        if not xs:
            counts.append(0)        
        elif i == xs[0]:
            cnt, xs = first_count_and_pop(xs)
            counts.append(cnt)
        else:
            counts.append(0)
    m = 0
    for i in range(0, 100000):
        if i == 0:
            temp = counts[i] + counts[i+1]
        elif i == 100000 - 1:
            temp = counts[i-1] + counts[i]
        else:
            temp = counts[i-1] + counts[i] + counts[i+1]
        if m < temp:
            m = temp
    print(m)

if __name__ == "__main__":
    main()

### FIXED CODE ###

input()
a_list = [int(s) for s in input().split()]

count = [0]*100002

for a in a_list:
    count[a] += 1
    count[a+1] += 1
    count[a+2] += 1
    
print(max(count))
### BUGGY CODE ###

# D
from collections import deque
import numpy as np
INF = float('inf')
h, w = map(int, input().split())
maps = []

for _ in range(h):
    lst = list(input())
    maps.append(lst)
maps = np.array(maps)

def bfs(start, maps, distance, height, width):
    d = deque()
    d.append(start)
    sx, sy = start
    distance[sx,sy] = 0
    
    while d:
        now = d.pop()
        nowx, nowy = now
        
        for i in range(0, 4):
            nx, ny = nowx + [1, 0, -1, 0][i], nowy + [0, 1, 0, -1][i]
            if (0<=nx<height)and(0<=ny<width):
                if (maps[nx,ny] == '.'):
                    if (distance[nx,ny] == -1) or \
                        (distance[nowx,nowy]+1<distance[nx,ny]):
                        d.append((nx, ny))
                        distance[nx,ny] = distance[nowx,nowy] + 1
    #print(distance)
    return distance.max()

cand = []
for sx in range(h):
    for sy in range(w):
        if maps[sx,sy] == '#':
            continue
        distance = np.full((h, w), -1)
        cand.append(bfs((sx, sy), maps, distance, h, w))
print(int(max(cand)))

### FIXED CODE ###

from collections import deque

def bfs(maze, visited, H, W, sx, sy):
    que = deque()
    que.append([sx, sy])
    visited[sx][sy] = 0
    ml = 0
    
    while que:
        x, y = que.popleft()
        
        for px, py in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            nx, ny = x+px, y+py
            if (0<=nx<H)and(0<=ny<W):
                if (maze[nx][ny] == '.')and(visited[nx][ny]==-1):
                    que.append([nx, ny])
                    dist = visited[x][y] + 1
                    visited[nx][ny] = dist
                    ml = max(ml, dist)
    return ml
                    

H, W = map(int, input().split())
maze = [input() for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            continue
        else:
            visited = [[-1]*W for _ in range(H)]
            ans = max(ans, bfs(maze, visited, H, W, i, j))
print(ans)
### BUGGY CODE ###

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

for i in range(M):
  A[N-1] >>= 1
  A = sorted(A)
print(sum(A))

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
A = map(int, input().split())
AA = [-1 * x for x in A]
#print(AA)
heapq.heapify(AA)

for i in range(M):
  a = heapq.heappop(AA)
  #print(a, -a>>1)
  heapq.heappush(AA, -(-a >> 1))

print(-sum(AA))
### BUGGY CODE ###

import collections

n, q = map(int, input().split())
edge = [tuple(map(int, input().split())) for _ in range(n - 1)]
p = [0] * n
for _ in range(q):
    x, y = map(int, input().split())
    p[x - 1] += y
counter = [0] * n

tree = [[] for _ in range(n)]
edge.sort()
edge = collections.deque(edge)
flag = [False] * n
flag[0] = True
while len(edge) != 0:
    a, b = edge.popleft()
    if flag[a - 1]:
        tree[a - 1].append(b - 1)
        flag[b - 1] = True
    elif flag[b - 1]:
        tree[b - 1].append(a - 1)
        flag[a - 1] = True
    else:
        edge.append((a, b))

que = collections.deque([0])
while len(que) != 0:
    i = que.popleft()
    counter[i] += p[i]
    for j in tree[i]:
        counter[j] = counter[i]
        que.append(j)

print(' '.join([str(c) for c in counter]))

### FIXED CODE ###

import collections

n, q = map(int, input().split())
edge = [tuple(map(int, input().split())) for _ in range(n - 1)]
counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    counter[p - 1] += x

tree = [[] for _ in range(n)]
edge = collections.deque(edge)
while len(edge) != 0:
    a, b = edge.popleft()
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

que = collections.deque([0])
flag = [False] * n
while len(que) != 0:
    i = que.popleft()
    flag[i] = True
    for j in tree[i]:
        if flag[j]: continue
        counter[j] += counter[i]
        que.append(j)

print(' '.join([str(c) for c in counter]))
### BUGGY CODE ###

import numpy as np
N = int(input())

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

P = [0] + P
     
count = 0
for i in range(1, N+1):    
    if not any(P[i] > np.array(P[1:i+1])):
        count += 1

print(count)

### FIXED CODE ###

N = int(input())

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

P = [0] + P
     
count = 0
min = 10000000000000
for i in range(1, N+1):
    if min > P[i]:
        min = P[i]
    elif min < P[i]:
        continue
    """
    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
    """
    count += 1
        
    if P[i] == 1:
        break

print(count)
### BUGGY CODE ###

n,q=map(int,input().split());s=input();m=[[]];b=[1]*n
for i in range(n):
  if s[i] in m[0]:m[m[0].index(s[i])+1].append(i)
  else:
    m[0].append(s[i])
    m.append([i])
for i in range(q):
  t,d=input().split()
  if t in m[0]:
    w=m[0].index(t)+1
    if d=="L":
      for j in m[w]:
        if 0<j:b[j-1]+=b[j]
        b[j]=0
    else:
      for j in m[w][::-1]:
        if j<n-1:b[j+1]+=b[j]
        b[j]=0
print(sum(b))

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
td=[input().split()for _ in range(q)]
def check(i,x):
  for t,d in td:
    if s[i]==t:
      if d=="L":i-=1
      else:i+=1
    if i==x:return True
    if i==-1 or i==n:return False
  return False
ok=-1
ng=n
while ok+1!=ng:
  mid=(ok+ng)//2
  if check(mid,-1):ok=mid
  else:ng=mid
ans=ng
ok=-1
ng=n
while ok+1!=ng:
  mid=(ok+ng)//2
  if check(mid,n):ng=mid
  else:ok=mid
ans+=(n-ng)
print(max(0,n-ans))
### BUGGY CODE ###

n=int(input())
A=[int(i) for i in input().split()]
B=[0]*60
ans=0
mod=10**9+7
for i in range(n):
  a=str(bin(A[i]))[2:].zfill(60)
  for j in range(60):
    if a[j]=="0":
      ans=(ans+B[j]*(2**(59-j)))%mod
    else:
      ans=(ans+(i-B[j])*(2**(59-j)))%mod
      B[j]+=1
print(ans)


### FIXED CODE ###

n=int(input())
A=[int(i) for i in input().split()]
B=[0]*60
C=[0]*60
ans=0
mod=10**9+7
for i,a in enumerate(A):
  for j in range(60):
    if a%2==0:
      C[j]+=B[j]
    else:
      C[j]+=i-B[j]
      B[j]+=1
    a//=2
for i in range(60):
  ans=(ans+C[i]*(pow(2,i,mod)))%mod
print(ans)
### BUGGY CODE ###

N, Ma, Mb = map(int, input().split())
items = []
ap = items.append
a_sum =0
b_sum = 0
for i in range(N):
    a, b, c = map(int, input().split())
    ap((a, b, c))
    a_sum += a
    b_sum += b

inf = float("inf")
dp = [[[inf for _ in range(b_sum + 10)] for _ in range(a_sum + 10)] for i in range(N + 1)]
dp[0][0][0] = 0
for i in range(N):
    for a in range(a_sum):
        for b in range(b_sum):
            dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b])
            dp[i + 1][a + items[i][0]][b + items[i][1]] = min(dp[i + 1][a + items[i][0]][b + items[i][1]],
                                                              dp[i][a][b] + items[i][2])

ans = inf
for a in range(1, a_sum + 1):
    for b in range(1, b_sum + 1):
        if a * Mb == b * Ma:
            ans = min(ans, dp[N][a][b])
if ans != inf:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

N, Ma, Mb = map(int, input().split())
items = []
for i in range(N):
    a, b, c = map(int, input().split())
    items.append((a, b, c))

a_sum = sum([item[0] for item in items])
b_sum = sum([item[1] for item in items])
inf = float("inf")
dp = [[[inf for _ in range(a_sum + 100)] for _ in range(b_sum + 100)] for i in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
    for a in range(a_sum + 1):
        for b in range(b_sum + 1):
            dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b])
            dp[i + 1][a + items[i][0]][b + items[i][1]] = min(dp[i + 1][a + items[i][0]][b + items[i][1]],
                                                              dp[i][a][b] + items[i][2])
ans = inf
for a in range(1, a_sum + 1):
    for b in range(1, b_sum + 1):
        if a * Mb == b * Ma:
            ans = min(ans, dp[N][a][b])
if ans != inf:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

n = int(input())
a = sorted([int(i) for i in input().split()])
set_a = set(a)
max_a = max(a)
dup_a = {ai for ai in set_a if a.count(ai) > 1}
nd = [True] * (max_a + 1)
cnt = 0
for ai in sorted(list(set_a)):
    if nd[ai] == True and ai not in dup_a:
        cnt += 1
    multi = 2
    while ai*multi <= max_a:
        nd[ai*multi] = False
        multi += 1
print(cnt)

### FIXED CODE ###

n = int(input())
a = sorted([int(i) for i in input().split()])
max_a = max(a)
cnt_d = [0] * (max_a + 1)

for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1

cnt_nd = 0
for ai in a:
    if cnt_d[ai] == 1:
        cnt_nd += 1
print(cnt_nd)
### BUGGY CODE ###

import sys
a, v = list(map(lambda x: int(x), input().split(" ")))
b, w = list(map(lambda x: int(x), input().split(" ")))
t = int(input())

direction = 1 if b > a else - 1
if a == b:
  print('YES')
  sys.exit()

for i in range(0,t):
  a = a + direction * v
  b = b + direction * w
  if direction == 1 and a >= b:
    print('YES')
    sys.exit()
  if direction == -1 and a <= b:
    print('YES')
    sys.exit()

print('NO')

### FIXED CODE ###

import sys
a, v = list(map(lambda x: int(x), input().split(" ")))
b, w = list(map(lambda x: int(x), input().split(" ")))
t = int(input())

direction = 1 if b > a else - 1
if a == b:
  print('YES')
  sys.exit()


a = a + direction * v * t
b = b + direction * w * t
if direction == 1 and a >= b:
  print('YES')
  sys.exit()
if direction == -1 and a <= b:
  print('YES')
  sys.exit()

print('NO')
### BUGGY CODE ###

n = int(input())

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

for i in range(1,n+1):
    print(A.count(i))

### FIXED CODE ###

n = int(input())

A = list(map(int,input().split()))
ans = [0] * n
for a in A:
    ans[a-1] += 1

for a in ans:
    print(a)
### BUGGY CODE ###

k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26 = [1] * (k + 1)
pow25 = [1] * (k + 1)
comb = [1] * (k + 1)

for i in range(k):
  pow26[i+1] = (pow26[i] * 26) % MOD
  pow25[i+1] = (pow25[i] * 25) % MOD
  comb[i+1] = (comb[i] * (len_s + i) * pow(i + 1, -1, MOD)) % MOD

a = 0
for i in range(k + 1):
  a += (comb[k-i] * pow26[i] * pow25[k-i]) % MOD
  a %= MOD

print(a)

### FIXED CODE ###

k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

x_i = pow(26, k, MOD)
r = (25 * pow(26, -1, MOD)) % MOD
comb_i = 1

a = 0
for i in range(k + 1):  
  a += (comb_i  * x_i  ) % MOD
  a %= MOD
  
  x_i  = (x_i  * r) % MOD
  comb_i = (comb_i * (len_s + i) * pow(i + 1, -1, MOD)) % MOD


print(a)
### BUGGY CODE ###

from collections import Counter
s=input()
n=len(s)
M=[0]*(n+1)
mod=2019
for i in range(n):
	M[n-1-i]=(M[n-i]+int(s[n-1-i])*10**i%mod)%mod
MC=Counter(M)
r=0
for v in MC.values():
	if v>1:
		r+=v*(v-1)//2
print(r)

### FIXED CODE ###

from collections import Counter
s=input()
n=len(s)
M=[0]
mod=2019
for i in range(n):
	m=(M[-1]+int(s[n-1-i])%mod*pow(10,i,mod))%mod
	M.append(m)
MC=Counter(M)
r=0
for v in MC.values():
	if v>1:
		r+=v*(v-1)//2
print(r)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
ans  = 0
for i in range(N):
    A.pop(-1)
    ans += A.pop(-1)
    A.pop(0)
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
ans  = 0
for i in range(1,2*N + 1,2):
    ans += A[i]
print(ans)