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

def main():
    n = int(input())
    a = list(map(int, input().split()))
    s = set(a)
    ans = 0
    for x in s:
        y = a.count(x)
        if x == y:
            continue
        if x > y:
            ans += y
        else:
            ans += y - x

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    n = int(input())
    a = list(map(int, input().split()))
    b = Counter(a)
    ans = 0
    for k, v in b.items():
        if k == v:
            continue
        if k > v:
            ans += v
        else:
            ans += v - k

    print(ans)


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

n = input()
C = [map(int, raw_input().split()) for i in xrange(n)]
memo = {(i, i): 0 for i in xrange(n)}
def calc(i, j):
    if (i, j) in memo:
        return memo[i, j]
    return min(calc(i, k) + calc(k+1, j) + C[i][0]*C[k][1]*C[k+1][0]*C[j][1] for k in xrange(i, j))
print calc(0, n-1)

### FIXED CODE ###

n = input()
C = [map(int, raw_input().split()) for i in xrange(n)]
memo = {(i, i): 0 for i in xrange(n)}
def calc(i, j):
    if (i, j) in memo:
        return memo[i, j]
    res = memo[i, j] = min(calc(i, k) + calc(k+1, j) + C[i][0]*C[k][1]*C[k+1][0]*C[j][1] for k in xrange(i, j))
    return res
print calc(0, n-1)
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m=map(int,input().split())
A=UnionFind(n)
P=list(map(int,input().split()))
for i in range(m):
  a,b=map(int,input().split())
  a=a-1
  b=b-1
  A.union(a,b)
AA=list(A.all_group_members().values())
V=[0]*n
ans=0
for i in range(len(AA)):
  B=[P[AA[i][j]]-1 for j in range(len(AA[i]))]
  ans=ans+len(AA[i])+len(B)-len(set(AA[i])|set(B))
print(ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m=map(int,input().split())
A=UnionFind(n)
P=list(map(int,input().split()))
for i in range(m):
  a,b=map(int,input().split())
  a=a-1
  b=b-1
  A.union(a,b)
V=[0]*n
ans=0
AA=[]
c=0
C={}
V=[0]*n
for i in range(n):
  if A.parents[i]<0:
    AA.append([i])
    C[i]=c
    c=c+1
    V[i]=1
for i in range(n):
  if V[i]==0:
    AA[C[A.find(i)]].append(i)
for i in range(len(AA)):
    B=[]
    for j in range(len(AA[i])):
      B.append(P[AA[i][j]]-1)
    ans=ans+len(AA[i])+len(B)-len(set(AA[i])|set(B))
print(ans)
### BUGGY CODE ###

import bisect
a,b,q=map(int,input().split())
S=[10**12];T=[10**12]
for _ in range(a):
    s=int(input())
    S.append(s)
for _ in range(b):
    t=int(input())
    T.append(t)
S.sort()
T.sort()

for _ in range(q):
    x=int(input())
    idx_s=bisect.bisect_left(S,x)
    idx_t=bisect.bisect_left(T,x)
    se=S[idx_s]
    sw=S[idx_s-1]
    te=T[idx_t]
    tw=T[idx_t-1]

    m1=abs(x-se)+abs(se-te)
    m2=abs(x-se)+abs(se-tw)
    m3=abs(x-sw)+abs(sw-te)
    m4=abs(x-sw)+abs(sw-tw)
    m5=abs(x-te)+abs(te-se)
    m6=abs(x-te)+abs(te-sw)
    m7=abs(x-tw)+abs(tw-se)
    m8=abs(x-tw)+abs(tw-sw)
    print(min(m1,m2,m3,m4,m5,m6,m7,m8)) 
    




### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
S=[];T=[]
for _ in range(a):
    s=int(input())
    S.append(s)
for _ in range(b):
    t=int(input())
    T.append(t)
S.append(10**12)
T.append(10**12)

for _ in range(q):
    x=int(input())
    idx_s=bisect.bisect_left(S,x)
    idx_t=bisect.bisect_left(T,x)
    se=S[idx_s]
    sw=S[idx_s-1]
    te=T[idx_t]
    tw=T[idx_t-1]

    ans=float("inf")
    for ss in [se,sw]:
        for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
    print(ans)
### BUGGY CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(K):
    tmp = [0]*N
    for i in range(N):
        left = max(0, i-A[i])
        right = min(N-1, i+A[i])
        for j in range(left, right+1):
            tmp[j] += 1
    A = tmp[:]
    if all([N == x for x in A]):
        break
print(*A)

### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(min(K, 42)):
    B = [0]*N
    for i in range(N):
        left = max(0, i-A[i])
        right = min(N-1, i+A[i])
        B[left] += 1
        if right+1 <= N-1:
            B[right+1] -= 1
    for i in range(N-1):
        B[i+1] += B[i]
    A = B[:]
print(*A)
### BUGGY CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
dp = [INF for i in range(N)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[N-1])


### FIXED CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
dp = [INF for i in range(N)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[N-1])
### BUGGY CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
e = [0] * N
for i in range(N):
    e[i] = sum(list(range(p[i]+1))) / p[i]   
ans = -1
for i in range(N):
    if ans < sum(e[i:i+K]):
        ans = sum(e[i:i+K])
print(ans)

### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)
### BUGGY CODE ###

import itertools

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

dp = [[float('inf')] * (N+1) for _ in range(N+1)]
# dp[Y][X] = 1
dp[X][Y] = 1

for i in range(1,N+1):
    for j in range(i,N+1):
        if i == j:
            dp[i][j] = 0
        elif i == X and j == Y:
            dp[X][Y] = 1
        elif i <= X:
            dp[i][j] = min(dp[i][j-1] + 1, dp[i][X] + abs(Y - j) + 1)
        else:
            dp[i][j] = min(dp[i][j-1]+ 1, abs(i - X)+ abs(Y - j) + 1 )

dp = list(itertools.chain.from_iterable(dp))
for i in range(1,N):
    print(dp.count(i))


### FIXED CODE ###

import itertools

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

# dp = [[float('inf')] * (N+1) for _ in range(N+1)]
# # dp[Y][X] = 1
# dp[X][Y] = 1

# for i in range(1,N+1):
#     for j in range(i,N+1):
#         if i == j:
#             dp[i][j] = 0
#         elif i == X and j == Y:
#             dp[X][Y] = 1
#         elif i <= X:
#             dp[i][j] = min(dp[i][j-1] + 1, dp[i][X] + abs(Y - j) + 1)
#         else:
#             dp[i][j] = min(dp[i][j-1]+ 1, abs(i - X)+ abs(Y - j) + 1 )

# dp = list(itertools.chain.from_iterable(dp))
# for i in range(1,N):
#     print(dp.count(i))

result = [0] * N

for i in range(1, N):
    for j in range(i+1, N+1):
        dist = min(abs(j-i), abs(X-i) + 1 + abs(j-Y), abs(Y-i)+1+abs(j-X))
        result[dist] += 1

for i in range(1, N):
    print(result[i])
### BUGGY CODE ###

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

total = 0
while len(A) > 0:
    i = A.index(min(A))
    if B[i] == M:
        total += A[i] * B[i]
        break
    elif B[i] > M:
        total += A[i] * M
        break
    else:
        total += A[i] * B[i]
        M -= B[i]
        A.pop(i)
        B.pop(i)
print(total)

### FIXED CODE ###

N, M = map(int, input().split())
shop = []
for i in range(N):
    shop.append(list(map(int, input().split())))

shop.sort()

total = 0
for i in range(len(shop)):
    if shop[i][1] == M:
        total += shop[i][0] * shop[i][1]
        break
    elif shop[i][1] > M:
        total += shop[i][0] * M
        break
    else:
        total += shop[i][0] * shop[i][1]
        M -= shop[i][1]
print(total)
### BUGGY CODE ###

import numpy as np


N, W = map(int, input().split())
w_v = [[int(_) for _ in input().split()] for _ in range(N)]
dp = np.zeros([N, W+1], dtype=int)
dp[0][w_v[0][0]:] = w_v[0][1]

for i in range(1, N):
    dp[i][:w_v[i][0]] = dp[i-1][:w_v[i][0]]
    for w in range(w_v[i][0], W+1):
        dp[i][w] = max(dp[i-1][w], dp[i-1][w - w_v[i][0]] + w_v[i][1])

print(dp[-1][-1])

### FIXED CODE ###

import numpy as np


N, W = map(int, input().split())
w_v = [[int(_) for _ in input().split()] for _ in range(N)]
dp = np.zeros([N, W+1], dtype=int)
dp[0][w_v[0][0]:] = w_v[0][1]

for i in range(1, N):
    key = w_v[i][0]
    dp[i][:key] = dp[i-1][:key]
    dp[i][key:] = np.maximum(dp[i-1][key:], dp[i-1][:-key] + w_v[i][1])

print(dp[-1][-1])
### BUGGY CODE ###

import collections
a = input().split()
M = int(a[2])
hidari = []
migi = []
c = []
 
for i in range(M):
  b = input().split()
  hidari.append(b[0])
  migi.append(b[1])
  c.append(b)
  
countleft = collections.Counter(hidari)
countright = collections.Counter(migi)
leftmax = countleft.most_common()[0][1]
rightmax = countright.most_common()[0][1]
tempmax = int(leftmax + rightmax)
 
leftkeys = [k for k, v in countleft.items() if v == leftmax]
rightkeys = [k for k, v in countright.items() if v == rightmax]

leftkeyN = int(len(leftkeys))
rightkeyN = int(len(rightkeys))
flag = int(0)
cnt = int(0)
#これで左右の最頻回数はOK
#左右の最頻奴も探した
#ここから最頻同志になってるやつを探す
 
for T in range(M):
    if c[T][0] in leftkeys and c[T][1] in rightkeys:
        cnt = cnt + 1
    else:
        pass
 
 
if cnt == int(leftkeyN * rightkeyN):
    print(int(tempmax - 1))
else:
    print(int(tempmax))
 
        

### FIXED CODE ###

import collections
a = input().split()
M = int(a[2])
hidari = []
migi = []
c = []
 
for i in range(M):
  b = input().split()
  hidari.append(b[0])
  migi.append(b[1])
  c.append(b)
  
countleft = collections.Counter(hidari)
countright = collections.Counter(migi)
leftmax = countleft.most_common()[0][1]
rightmax = countright.most_common()[0][1]
tempmax = int(leftmax + rightmax)
 
leftkeys = [k for k, v in countleft.items() if v == leftmax]
rightkeys = [k for k, v in countright.items() if v == rightmax]
 
leftkeyN = int(len(leftkeys))
rightkeyN = int(len(rightkeys))
flag = int(0)
cnt = int(0)
#これで左右の最頻回数はOK
#左右の最頻奴も探した
#ここから最頻同志になってるやつを探す
 
for i in range(M):
    goukei = int(countleft.get(c[i][0])) + int(countright.get(c[i][1]))
    if goukei == tempmax:
        cnt += 1
    else:
        pass

if cnt == int(leftkeyN * rightkeyN):
    print(int(tempmax - 1))
else:
    print(int(tempmax))
### BUGGY CODE ###

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

d = {}

for item in s:
    if item in d.keys():
        d[item] += 1
    else:
        d[item] = 1

m = [k for k, v in d.items() if v == max(d.values())]
m.sort()
for item in m:
    print(item)


### FIXED CODE ###

from collections import Counter
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

cnt_words = Counter(s)

mode_v = cnt_words.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, cnt_words.most_common()
)
m = []
for i in it:
    m.append(i[0])
m.sort()
for item in m:
    print(item)
### BUGGY CODE ###

from math import sqrt as sq
n=int(input())
c=0
for i in range(1,n):
    s=set()
    k=n-i
    for i in range(1,int(sq(n))+1):
        if k%i==0:
            s.add(i)
            s.add(k//i)
    c+=(len(s))
print(c)

### FIXED CODE ###

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

def main():
    x,y = map(int,input().split())
    tmp = []
    for i in range(1,max(2,min(int(x // 2), int(y // 2 )))):
        if x % i ==0 and y % i == 0:
            tmp.append(i)
    cnt = 0
    # print(tmp)
    flg = 0
    for i,a in enumerate(tmp):
        # print('out' + str(i) + ' ' + str(a))
        if a == 1:
            continue
        leng = len(tmp)
        for j in range(i+1,leng):
            # print(j)
            # print(tmp)
            # print(leng)
            if flg == 1:
                j -=1
            flg = 0
            if j >= leng:
                break
            # print(str(j) + ' ' + str(leng) + ' ' + str(tmp[j]))
            if tmp[j] % a == 0:
                tmp.pop(j)
                leng -=1
                j -= 1
                # print(tmp)
                # print(j)
                flg = 1

                    # print(j)
                    # print(a)


    print(len(tmp))
    # print(tmp)
if __name__=='__main__':
    main()


### FIXED CODE ###

def main():
    x,y = map(int,input().split())
    tmp = [1]
    i = 2
    ans = 0
    # if x == y:
    #     ans += 1
    # a = factorization(x)
    # print(a)
    tempx = x

    for i in range(2, int(-(-x**0.5//1))+1):
        if tempx % i == 0:
            tmp.append(i)
            while tempx % i == 0:

                tempx //= i
    if tempx!=1:
        tmp.append(tempx)
    # print(tmp)

    for i,a in enumerate(tmp):
        if y % a == 0:
            tmp[i] = 1
        else:
            tmp[i] = 0
    print(sum(tmp))


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

import sys
from itertools import accumulate
input=sys.stdin.buffer.readline
def int(s):
    a=s[0]-48
    for t in s[1:]:
        a*=10
        a+=t-48
    return a
def main():
    n,k=map(int,input().split())
    a=[*map(int,input().split())]
    for _ in'_'*k:
        b=[0]*n
        for i,t in enumerate(a):
            if(j:=i-t)<0:j=0
            b[j]+=1
            if(j:=i-~t)<n:b[j]-=1
        a=[*accumulate(b)]
        if min(a)==n:break
    print(' '.join(map(str,a)))
main()

### FIXED CODE ###

def main():
    n,k,*a=map(int,open(0).read().split())
    for _ in range(k):
        b=[0]*n
        m=10**18
        for i,t in enumerate(a):
            if t<m:m=t
            b[max(0,i-t)]+=1
            if i-~t<n:b[i-~t]-=1
        if m>=n:break
        for i in range(n-1):b[i+1]+=b[i]
        a=b
    print(' '.join(map(str,a)))
main()
### BUGGY CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))

mi = min(A)

def mak(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list
    
P = mak(mi)[1:][::-1]
lenp = len(P)

Q = np.array(A)

an = 1
for i in range(lenp):
    R = Q % P[i]
    if any(R) == 0:
        an = P[i]
        break
    else:
        Q = R[R!=0]

print(an)

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))
flag = 0
#mi = min(A)
Q = np.array(A)
an = 1
def toku(Q):
    mi = min(Q)
    R1 = Q % mi
    if any(R1) == 0:
        flag = 1
        an = mi
        return flag, an, R1
    else:
        flag = 0
        an = 1
        ind = np.argmin(Q)
        R1[ind] = mi
        R = R1[R1!=0]
        return flag, an, R

while flag == 0:
    flag,an,PP = toku(Q)
    Q = PP

print(an)
### BUGGY CODE ###

from itertools import combinations

EPS = 1e-8

N, K, *XYC = map(int, open(0).read().split())
PC = [(complex(x, y), c) for x, y, c in zip(*[iter(XYC)] * 3)]


def intersection(A, r, B, s):
    D = B - A
    d = abs(D)

    cos_t = (d * d + r * r - s * s) / (2 * d * r)
    sin_t = max(1 - cos_t * cos_t, 0.0) ** 0.5

    R = r * complex(cos_t, sin_t)
    D /= d

    return (
        A + D * R,
        A + D * R.conjugate(),
    )


def is_ok(T):
    A = [p for p, _ in PC]
    for (p1, c1), (p2, c2) in combinations(PC, 2):
        A += intersection(p1, T / c1, p2, T / c2)

    return any(K <= sum(1 for p, c in PC if c * abs(a - p) < T + EPS) for a in A)


ng, ok = 0, 100000
for _ in range(80):
    md = (ng + ok) / 2
    if is_ok(md):
        ok = md
    else:
        ng = md

print(ok)

### FIXED CODE ###

from math import hypot
from collections import deque

N, K, *XYC = map(int, open(0).read().split())
XYC = list(zip(*[iter(XYC)] * 3))

Q = deque([(0, 0, 1000.0)])

ans = float("inf")
while Q:
    X, Y, r = Q.popleft()
    if ans * 0.9999995 > sorted(c * hypot(max(abs(X - x) - r, 0), max(abs(Y - y) - r, 0)) for x, y, c in XYC)[K - 1]:
        ans = min(ans, sorted(c * hypot(X - x, Y - y) for x, y, c in XYC)[K - 1])
        for dx, dy in [(-0.5, -0.5), (-0.5, 0.5), (0.5, -0.5), (0.5, 0.5)]:
            Q.append((X + dx * r, Y + dy * r, r / 2))

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

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

for k in range(1, N):
  count = 0
  for i in range(1, N):
    for j in range(i + 1, N + 1):
      if k == min( j - i, abs(X - i) + 1 + abs(Y - j) ):
        count += 1

  print(count)


### FIXED CODE ###

N, X, Y = map(int, input().split())
X -= 1
Y -= 1


count = [0] * N
for i in range(N-1):
  for j in range(i + 1, N):
    count[min( j - i, abs(X - i) + 1 + abs(Y - j) )] += 1

for i in range(1, N):
  print(count[i])
### BUGGY CODE ###

from itertools import product as prod

n = int(input().strip())
s = [int(input()) for _ in range(n)]
ans = 0
for elem in (prod([0, 1], repeat=n)):
    rep = 0
    for i in range(n):
        if elem[i]:
            rep += s[i]
    if rep % 10 == 0:
        rep = 0
    ans = max(ans, rep)
print(ans)


### FIXED CODE ###

n = int(input().strip())
s = [int(input()) for _ in range(n)]
s.sort()
su = sum(s)
if su % 10 == 0:
    for elem in s:
        if (su - elem) % 10 != 0:
            print(su - elem)
            exit()
    print(0)
else:
    print(su)
### BUGGY CODE ###

x = input()

l = len(x)
for i in range(l//2):
    if "ST" in x:
        x = x.replace("ST", "")

print(len(x))


### FIXED CODE ###

x = input()

s = []
for i in range(len(x)):
    if x[i] == "S":
        s.append(x[i])
    else:
        if len(s) != 0 and s[-1] == "S":
            s.pop(-1)
        else:
            s.append(x[i])

print(len(s))
### BUGGY CODE ###

N = int(input())
S = []
ans = N


for i in range(N):
    s = input()
    if i == 0:
        S.append(s)
    else:
        flg = 0
        j  = 0
        while(flg == 0 and j < len(S)):
            if i != j:
                if S[j] == s:
                    flg = 1
                    ans = ans - 1
            j = j+1
        if flg == 0:
            S.append(s)
        
print(ans)

### FIXED CODE ###

N = int(input())
S = []
ans = N
S = [input() for i in range(N)]
#for i in range(N):
#    S.append(input())
S.sort()
for i in range(N-1):
    if S[i] == S[i+1]:
        ans = ans - 1
print(ans)
### BUGGY CODE ###

nk = input().split()
tmp = input().split()
n = int(nk[0])
k = int(nk[1])

s = [0]*n
hai = [0]*n
max = 0

for i in range(n):
  hai[i] = (sum(range(int(tmp[i])))+int(tmp[i]))/int(tmp[i])
for i in range(n):
  for j in range(k):
   t = sum(hai[(i-j):(i+k-j)])
   if max < t :
      max = t
print(max)

### FIXED CODE ###

n ,k = map(int ,input().split())
hai = list(map(lambda x:(int(x)+1)/2 ,input().split()))
hait= hai[:k]
ans = tmp = sum(hait)
for i in range(k,n):
  tmp = tmp - hai[i-k] + hai[i]
  if ans < tmp:
    ans = tmp
print(ans)
### BUGGY CODE ###

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

x.sort()
diffx = [x[i+1]-x[i] for i in range(M-1)]

if M == 1:
    print(0)
else:
    for i in range(N-1):
        idx = diffx.index(max(diffx))
        diffx[idx] = 0
    print(sum(diffx))

### FIXED CODE ###

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

x.sort()
diffx = [x[i+1]-x[i] for i in range(M-1)]
diffx.sort(reverse = True)

if M == 1:
    print(0)
else:
    tmp = sum(diffx[:(N-1)])
    print(x[-1] - x[0] - tmp)
### BUGGY CODE ###

from collections import deque
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    N = int(input())
    check = deque()
    def my_index(l, x, default=False):
        return l.index(x) if x in l else default

    for _ in range(N):
        A = int(input())
        if A not in check:
            check.append(A)
        else:
            check.remove(A)
    print(len(check))

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    N = int(input())
    A = [input() for _ in range(N)]
    common = Counter(A).most_common()
    ans = 0
    for i in common:
        if i[1] % 2 == 1:
            ans += 1
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n=int(input())
p=list(map(int, input().split()))
count2=0
for i in range(n):
  count1=0
  for j in range(i+1):
    if p[i] <= p[j]:
      count1 += 1
  if count1 == i+1:
    count2 += 1
print(count2)

### FIXED CODE ###

n=int(input())
p=list(map(int, input().split()))
min = p[0]
count=0
for i in range(n):
  if p[i] <= min:
    min = p[i]
    count += 1
print(count)
### BUGGY CODE ###

import fractions as frac
a, b, c, d, e, f = map(int, input().split())
memo=[[(-1, -1)]*100000 for i in range(10000)]
func = lambda t: frac.Fraction(t[0], t[1] ) if t[1]>0 else -1
def dp(s, w):
    if w*e<s or w*100+s>f:
        return (-1, -1)
    m=memo[s][w]
    if m[0]>0:
        return memo[s][w]
    p0=(s,w) 
    p1=dp(s, w+a)
    p2=dp(s, w+b)
    p3=dp(s+c, w)
    p4=dp(s+d, w)
    memo[s][w]=max(p0, p1, p2, p3, p4, key = func) if w>0 else max(p1, p2, key = func)
    return memo[s][w]
    
ans=dp(0,0)
print(ans[0]+ans[1]*100, ans[0])

### FIXED CODE ###

import fractions as frac
a, b, c, d, e, f = map(int, input().split())
memo=[[(-1, -1)]*1000 for i in range(10000)]
func = lambda t: frac.Fraction(t[0], t[1]) if t[1]>0 else -10
def dp(s, w):
    if w*e<s or w*100+s>f:
        return (-1, -1)
    m=memo[s][w]
    if m[0]>0:
        return m
    p0=(s,w) 
    p1=dp(s, w+a)
    p2=dp(s, w+b)
    p3=dp(s+c, w)
    p4=dp(s+d, w)
    memo[s][w]=max(p0, p1, p2, p3, p4, key = func) if w>0 else max(p1, p2, key = func)
    return memo[s][w]
    
ans=dp(0,0)
print(ans[0]+ans[1]*100, ans[0])
### BUGGY CODE ###

k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s:
      break
    for c in range(m):
      if a+b+c==s:
        x+=1
        break
print(x)

### FIXED CODE ###

k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s or a+b<s-k:
      continue
    x+=1
print(x)