Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int, input().split()))

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

count = gcd_list(a)
ans = 0
while count%2 == 0:
    ans += 1
    count /= 2
    
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(len(a)):
    count = 0
    while a[i]%2 == 0:
        a[i] = a[i]/2
        count += 1
    if a[i]%2 == 1:
        ans.append(count)
print(min(ans))
n, k = map(int, input().split())
a = list(set([int(input) for _ in range(n)]))
if k >= len(a):
    print(0)
else:
    print(k - len(a))

### FIXED CODE ###

# https://atcoder.jp/contests/abc081/tasks/arc086_a

from collections import Counter

n, k = map(int, input().split())
a = list(sorted(map(int, input().split())))
c = Counter(a)
current_k = len(c)
xlst = c.most_common(current_k)[k:]

answer = 0
for x in xlst:
    answer += x[1]

print(answer)
def solve(n):
    n = list(range(1, n))
    return sum(n)


N = int(input())

print(solve(N))


### FIXED CODE ###

def solve(n):
    return n * (n - 1) // 2


N = int(input())

print(solve(N))
length = int(input())
string = input()
count=0

if(length>=3):
    for i in range(0,length):
        if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]):
            count+=1
            i+=3
            if i>length-3:
                break

print(count)

### FIXED CODE ###

length = int(input())
string = input()
print(string.count("ABC"))
s=list(input())
k=int(input())
s.append(-1)
i=0
ans=-1
while True:
    if s[i]=="-1":
        ans=s[i]
        break
    if s[i]!="1":
        ans=s[i]
        if i+1>k:
            ans="1"   
        break
    i+=1
print(ans)


### FIXED CODE ###

n=int(input())
ls=list(map(int,input().split()))
ls.sort()

print(ls[n//2]-ls[n//2-1])
S = list(int(input()))
N = len(S)
ans = 999
for i in range(0, N - 3):  #1 2 3 4 5 6 7 #0 1 2 3 4 5 6
	num = S[i] * 100 + S[i + 1] * 10 + S[i + 2]
	if ans > abs(num - 753):
		ans = abs(num - 753)
print(ans)							


### FIXED CODE ###

s = input()
 
ans = 1000
for i in range(len(s)-2):
    ans = min(ans, abs(753-int(s[i:i+3])))
print(ans)
#!/usr/bin/env python

def popcount(n):
    ret = 0
    for i in range(18):
        if n>>i & 1:
            ret += 1
    return ret

def main():
    N = int(input())
    X = input()

    # X に含まれる "1" の数
    x_cnt = 0
    for i in range(N):
        if X[i] == "1":
            x_cnt += 1

    # i 桁目が 0 : x_cnt += 1
    # i 桁目が 1 : x_cnt -= 1
    # より, X mod x_cnt +1, X mod x_cnt-1 を事前計算しておく
    n_plus,n_minus = 0,0
    t_plus,t_minus = 1,1
    for i in range(N-1,-1,-1):
        if X[i]=="1":
            n_plus += t_plus
            n_plus %= x_cnt + 1
            n_minus += t_minus
            n_minus %= x_cnt - 1
        t_plus = (t_plus*2) % (x_cnt + 1)
        t_minus = (t_minus*2) % (x_cnt - 1)
    
    for i in range(N):
        ans = 1
        if X[i]=="1":
            # 1 -> 0 に変換した結果, １が全く存在しない場合
            if x_cnt == 1:
                print(0)
                continue
            a = (n_minus - pow(2,(N-1-i), x_cnt-1)) % (x_cnt-1)
        else:
            a = (n_plus + pow(2,(N-1-i), x_cnt+1)) % (x_cnt+1)
        while a > 0:
            pop_cnt = popcount(a)
            a %= pop_cnt
            ans += 1
        print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)
INF = float("inf")

def popcount(n):
    ret = 0
    for i in range(18):
        if n>>i & 1:
            ret += 1
    return ret

def main():
    N = int(input())
    X = input().decode().rstrip()

    # X に含まれる "1" の数
    x_cnt = X.count("1")

    # i 桁目が 0 : x_cnt += 1
    # i 桁目が 1 : x_cnt -= 1
    # より, X mod x_cnt +1, X mod x_cnt-1 を事前計算しておく
    x_mod_pl,x_mod_mi = 0,0
    d_pl,d_mi = 1,1
    mod_pl,mod_mi = x_cnt+1,max(1,x_cnt-1)
    for i in range(N-1,-1,-1):
        if X[i]=="1":
            x_mod_pl = (x_mod_pl + d_pl) % mod_pl
            x_mod_mi = (x_mod_mi + d_mi) % mod_mi
        d_pl = (d_pl*2) % mod_pl
        d_mi = (d_mi*2) % mod_mi
    
    for i in range(N):
        ans = 1
        if X[i] == "1":
            # 1 -> 0 に変換した結果, １が全く存在しない場合
            if x_cnt == 1:
                print(0)
                continue
            a = (x_mod_mi - pow(2,(N-1-i), mod_mi)) % mod_mi
        else:
            a = (x_mod_pl + pow(2,(N-1-i), mod_pl)) % mod_pl

        while a > 0:
            pop_cnt = popcount(a)
            a %= pop_cnt
            ans += 1

        print(ans)

if __name__ == "__main__":
    main()
n=input()
if n%2==0:
  print((n//2)/n)
else:
  print(((n//2)+1)/n)

### FIXED CODE ###

n=int(input())
if n%2==0:
  print((n//2)/n)
else:
  print(((n//2)+1)/n)
H, W = map( int, input().split() )
S = [ list( input() ) for _ in range(H) ]


# (i, j) から行けるペアの数
def dfs( i, j, isVisited ):
    ans = 0
    isVisited[i][j] = True
    if S[i][j] == '#':
        if i+1 < H and isVisited[i+1][j] == False:
            if S[i+1][j] == '.': ans += dfs( i+1, j, isVisited )+1
        if j+1 < W and isVisited[i][j+1] == False:
            if S[i][j+1] == '.': ans += dfs( i, j+1, isVisited )+1
        if i-1 >= 0 and isVisited[i-1][j] == False:
            if S[i-1][j] == '.': ans += dfs( i-1, j, isVisited )+1 
        if j-1 >= 0 and isVisited[i][j-1] == False:
            if S[i][j-1] == '.': ans += dfs( i, j-1, isVisited )+1
    else:
        if i+1 < H and isVisited[i+1][j] == False:
            if S[i+1][j] == '#': ans += dfs( i+1, j, isVisited )
        if j+1 < W and isVisited[i][j+1] == False:
            if S[i][j+1] == '#': ans += dfs( i, j+1, isVisited )
        if i-1 >= 0 and isVisited[i-1][j] == False:
            if S[i-1][j] == '#': ans += dfs( i-1, j, isVisited ) 
        if j-1 >= 0 and isVisited[i][j-1] == False:
            if S[i][j-1] == '#': ans += dfs( i, j-1, isVisited )
    return ans


ans = 0
for i in range(H):
    for j in range(W):
        isVisited = [ [False]*W for _ in range(H) ]
        if S[i][j] == '#': ans += dfs( i, j, isVisited )

print( ans )


### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(200000)

H, W = map( int, input().split() )
S = [ list( input() ) for _ in range(H) ]


isVisited = [ [False]*W for _ in range(H) ]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
# (i, j) から行けるペアの数
def dfs( x, y ):
    isVisited[x][y] = True
    numBlack, numWhite = 0, 0
    if S[x][y] == '#': numBlack = 1
    else:              numWhite = 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if 0 <= nx and nx < H and 0 <= ny and ny < W and not isVisited[nx][ny]:
            if S[x][y] != S[nx][ny]:
                tmpB, tmpW = dfs( nx, ny )
                numBlack += tmpB
                numWhite += tmpW
    return numBlack, numWhite

ans = 0
for i in range(H):
    for j in range(W):
        if not isVisited[i][j]: 
            numBlack, numWhite = dfs( i, j )
            ans += numBlack * numWhite

print( ans )
R=int,input()
r=2*3.14159265358979*R
print(r)

### FIXED CODE ###

R=int(input())
r=2*3.14159265358979*R
print(r)
n, k, s = map(int, input().split())

for i in range(1, n+1):
    if i <= k:
        print(s)
    else:
        if s == 10**9:
            print(1)
        else:
            print(10**9)


### FIXED CODE ###

from operator import itemgetter

n = int(input())
XLs = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]
    XLs[i].append(x+l)

#右手の端の位置でソート

XLs.sort(key=itemgetter(2))

choice = -10**10
cnt = 0
for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]

    if choice <= x-l:
        choice = x+l
        cnt += 1

print(cnt)
n, x = map(int,input().split())
xl = list(map(int,input().split()))

xl.append(x)
xl.sort()

onesam = 0
for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = one_sa
    else:
        if one_sa % onesam == 0:
            continue
        else:
            short,big = min(onesam,one_sa),max(onesam,ne_sa)
            if short == 1:
                onesam =1
                break
                
            while big % short != 0:
                for i in range(2,short):
                    if short % i == 0:
                        short = short // i
            if short == 1:
                onesam = 1
                break
            else:
                onesam = short
print(onesam)
        

### FIXED CODE ###

n, x = map(int,input().split())
xl = list(map(int,input().split()))

xl.append(x)
xl.sort()

onesam = 0

if len(xl) == 1:
    print(abs(xl[0] - x))
    exit()

for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = abs(one_sa)
    else:
        short,big = min(onesam,one_sa),max(onesam,one_sa)
        if big % short == 0:
            onesam = short
            continue
        else:
            while big % short != 0:
                short = short -1
#                 for k in range(2,short+1):
#                     if short % k == 0:
#                         short = short // k
#                         break
            onesam = short
            
print(onesam)
import math 
import bisect
import heapq
from collections import deque

h,w = map(int,input().split())
s = [map(int,input().split()) for _ in range(h)]
v = [ [0] * w ] * h

bfs(i,j,s,v):
    count = 0
    mx = 0
    if s[i][j] == '#': return 0
    elif:
        v[i][j] = 1
        if i+1 < h and j+1 < w 
            if v[i+1][j+1] != 1 and s[i+1][j+1] == '.'
                count += 1
                mx = max(count,mx)
                bfs(i+1,j+1,s,v)

        elif i+1 < h and j-1 > 0 
            if v[i+1][j-1] != 1 and s[i+1][j-1] == '.'
                count += 1
                mx = max(count,mx)
                bfs(i+1,j-1,s,v)

        elif i-1 < h and j+1 > 0 
            if v[i-1][j+1] != 1 and s[i-1][j+1] == '.'
                count += 1
                mx = max(count,mx)
                bfs(i-1,j+1,s,v)

        elif i-1 < h and j-1 > 0 
            if v[i+1][j-1] != 1 and s[i-1][j-1] == '.'
                count += 1
                mx = max(count,mx)
                bfs(i-1,j-1,s,v)


    return mx

ans = 1000000
for i in range(h):
    for j in range(w):
        x,y = i,j
        ans = min(ans,bfs(i,j,s,v))
        

### FIXED CODE ###

import math 
import bisect
import heapq
from collections import deque

h,w=map(int,input().split())
M=[]
M=[input() for _ in range(h)]
 
def bfs(x,y):
    dist=[[-1]*w  for _ in range(h)]
    seen=[[False]*w for _ in range(h)]
    stk=[(x,y,0)]
    while stk:
        px,py,dst=stk.pop(0)
        if seen[px][py]:
            continue
        seen[px][py]=True
        
        if M[px][py]=='#':
            dist[px][py]=0
            continue
        
        for x,y in [(-1,0),(1,0),(0,-1),(0,1)]:
            if px+x<0 or px+x>=h or py+y<0 or py+y>=w:
                continue
            else:
                stk.append((px+x,py+y,dst+1))
        dist[px][py]=dst
    ans=0
 
    for i in range(h):
        ans=max(max(dist[i]),ans)
    return ans
ans = 0
for i in range(h):
    for j in range(w):
        if M[i][j]=='#':
            continue
        ans=max(bfs(i,j),ans)
print(ans)
import fractions

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

b=[]
for i in a:
    b.append(abs(x-i))

if n==1:
    print(abs(x-a[0]))

else:
    ans=fractions.gcd(b[0],b[1])

    for i in range(2,n):
        ans = fractions.gcd(ans ,b[i])

    print(ans)


    





### FIXED CODE ###

a,b=map(int,input().split())
if a*b % 2 ==0:
    print('No')
else:
    print('Yes')
h,w=map(int,input().split())
a=""
for i in range(w+2):
    a=a+"a"
S=[a]
for i in range(h):
    S.append("a"+input()+"a")
S.append(a)
for i in range(1,h+1):
    for j in range(1,w+1):
        if S[i][j]==".":
            num=0
            for u in range(-1,2):
                for v in range(-1,2):
                    if S[i+u][j+v]=="#":
                        num+=1
            S[i]=S[i][:j-1]+str(num)+S[i][:j+1]
for i in range(1,h+1):
    print(S[i][1:w+1])

### FIXED CODE ###

h,w=map(int,input().split())
a=""
for i in range(w+2):
    a=a+"a"
S=[a]
for i in range(h):
    S.append("a"+input()+"a")
S.append(a)
for i in range(1,h+1):
    for j in range(1,w+1):
        if S[i][j]==".":
            num=0
            for u in range(-1,2):
                for v in range(-1,2):
                    if S[i+u][j+v]=="#":
                        num+=1
            S[i]=S[i][:j]+str(num)+S[i][j+1:]
for i in range(1,h+1):
    print(S[i][1:w+1])
# Get input from console, default to string
S = input()
S.sort() # alphabetical sort
if S == 'abc':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S = input()
#S = ''.join(sorted(list(S)))
if 'a' in S and 'b' in S and 'c' in S:
    print('Yes')
else:
    print('No')
def main():
    n = int(input())
    max_a, max_b = 0, 0 # type:int
    for _ in range(n):
        a, b = input().split(' ')
        a = int(a)
        if max_a < a:
            max_a = a
            max_b = int(b)
    print(max_a + max_b)


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    s = input()
    cnt = 0
    for c in s:
        if c == '1':
            cnt += 1
    print(cnt)
    return


if __name__ == "__main__":
    main()
def A(w, v, n,V):
    mem=[0 for i in range(V+1)]
    if n == 0 or V == 0:
        return 0
 
    for i in range(n):
        for j in range(V,w[i]-1,-1):
            mem[j] = max(mem[j], v[i]+ mem[j - w[i]])
    return mem[V]
n,V=input().split()
n,V=int(n),int(V)
 
w=[0]*n
v=[0]*n
for i in range(n):
  x,y=input().split()
  w[i],v[i]=int(x),int(y)
 
print(A(W,V,4,4))

### FIXED CODE ###

def fragOptimalJump(h,n):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
    return dp[n]
  
N=int(input())
read = [int(n) for n in input().split()]
H=[0]+read
print(fragOptimalJump(H,N))
a,b,k=map(int,input().split())
 
ans=[]
 
for i in range(1,min(a,b)+1):
	if a%i==0 and b%i==0:
		ans.append[i]
print(ans[k+1])

### FIXED CODE ###

a,b,k=map(int,input().split())
 
ans=[]
 
for i in range(1,min(a,b)+1):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k])
s,c = map(int,input().split())
if c/2 <= s:
	print(c//2)
else:
	print(s + (c-s*2)//4)

### FIXED CODE ###

n = int(input())
x = 800 * n
y = (n // 15) * 200
print(x-y)
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
mn=abs(A-(T-H[0]*0.006))
c=0
for i in range(N):
    if mn>abs(A-(T-H[i]*0.006)):
        mn=abs(A-(T-H[i]*0.006))
        c=i
print(c+1)


### FIXED CODE ###

a=list(map(int,input().split()))
print(int(a[0]+(a[1]/2)))
x = int(input())
n = [i**5 for i in range(63+1)]

a = 0
b = 0
res = False
i = 0
while not res:
    sign = 1 - 2*(n[i] < x)
    for j in range(i+1):
        if (n[i] - n[j] * sign) == x:
            print(i,j*sign)
            res = True
    i += 1

### FIXED CODE ###

x = int(input())
n = [i**5 for i in range(119+1)]

a = 0
b = 0
res = False
i = 0
while not res:
    sign = 1 - 2*(n[i] < x)
    for j in range(i+1):
        if (n[i] - n[j] * sign) == x:
            print(i,j*sign)
            res = True
    i += 1
def main():
    N, M = map(int, input().split(" "))
    mod = 1000000007
    A = []
    for _ in range(M):
        A.append(int(input()))
    F = [0] * (N + 1)
    A.sort()
    last_broken = 0
    if not A[0] == 1:
        F[0] = 1
    if M > 1 and not A[1] == 2:
        F[1] = 1 + F[0]
    print(F)
    for i in range(2, N + 1):
        if last_broken < M and not i == A[last_broken]:
            F[i] = (F[i-1] + F[i-2]) % mod
        else:
            last_broken += 1
    print(F[-1])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    mod = 1000000007
    N, M, *A = map(int, open(0).read().split())
    A = set(A)
    F = [0] * (N + 1)
    F[0] = 1
    if 1 not in A:
        F[1] = 1
    for i in range(2, N + 1):
        if i not in A:
            F[i] = (F[i-1] + F[i-2]) % mod
    print(F[N])


if __name__ == "__main__":
    main()
from math import factorial as f
n, k = (int(i) for i in input().split())
for i in range(1,k+1):
    u1 = f(n-k+1) / (f(n-k+1-i) * f(i))
    u2 = f(k-1) / (f(k-i) * f(i-1))
    ans = (u1 * u2) % (10**9 + 7)
    print(ans)

### FIXED CODE ###

n, k = (int(i) for i in input().split())
mod = 10**9 + 7
c = [[1], [1,1]]
for i in range(2,n+10):
    c.append([1] + [(c[i-1][j-1] + c[i-1][j]) % mod for j in range(1,i)] + [1])

for i in range(1, k + 1):
    if n - k + 1 < i or k < i:
        print("0")
    else:
        step1 = c[n-k+1][i]
        step2 = c[k-1][i-1]
        ans = (step1 * step2) % mod
        print(int(ans))
N,M=map(int,input().split())
A=list(map(int,input().split()))

L=sum(A)
if L>N:
    print(-1)
else:
    print(N-L)

### FIXED CODE ###

import  math

R=int(input())

print(2*math.pi*R)
import sys
input = sys.stdin.readline

N = int(input())
N = N-1
S = input()
s = ' '
o = ' '
n = 0
for i in range(N):
  if S[n] == S[n+1]:
    if s[-1] != S[n]:
      s = s + S[n]
    n = n + 1
  else:
    if s == o:
      s = s + S[n]
      s = s.lstrip()
    s = s + S[n+1]
    n = n + 1
print(len(s.lstrip()))

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

C = B * 2

if A<C:
  print(0)
else:
  D = A - C
  print(D)
import numpy as np
N = int(input())
S = input()
L = [str(i).zfill(3) for i in range(1000)]


def contain(l):
    phase = 0
    for c in S:
        if phase == 0 and c == l[0]:
            phase = 1
            continue
        if phase == 1 and c == l[1]:
            phase = 2
            continue
        if phase == 2 and c == l[2]:
            return 1
    return 0


f = np.frompyfunc(contain, 1, 1)
print(sum(f(L)))


### FIXED CODE ###

N = int(input())
S = input()
L = [str(i).zfill(3) for i in range(1000)]
count = 0
for l in L:
    try:
        i = S.index(l[0])
        j = S.index(l[1], i + 1)
        k = S.index(l[2], j + 1)
        count += 1
    except:
        continue
print(count)
n,k = map(int,input().split())
enemy = list(map(int,input().split()))

enemy.sort(reverse=True)

for x in range(k):
  enemy[x] = 0
  
print(sum(enemy))

### FIXED CODE ###

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

enemy.sort(reverse=True)

if k >= n :
  print(0)

else:
  

  for x in range(k):
    enemy[x] = 0
  
  print(sum(enemy))
s = input()
cnt = 0
for l in range(len(s)):
    r = l + 1
    while r < len(s) and int(s[l:r]) % 2019 != 0:
        r += 1
    if int(s[l:r]) % 2019 == 0:
        cnt += 1
        print(i, j, s[i:j])
print(cnt)       

### FIXED CODE ###

M = 2019
s = input()
tot, ten, ans = 0, 1, 0
cnt = [0] * M
for si in s[::-1]:
    cnt[tot] += 1
    tot += int(si) * ten
    tot %= M
    ans += cnt[tot]
    ten *= 10
    ten %= M
print(ans)
c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    x0, y0=map(int,raw_input().split())
    prev_x, prev_y=x0, y0
    tmp=0
    for i in range(n-1):
        x,y=map(int,raw_input().split())
        tmp+=prev_x*y - prev_y*x
        prev_x, prev_y=x, y
    tmp+=prev_x*y0 - prev_y*x0
    print c, 0.5*abs(tmp)
    input()
    
   

### FIXED CODE ###

c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    x0, y0=map(int,raw_input().split())
    prev_x, prev_y=x0, y0
    tmp=0
    for i in range(n-1):
        x,y=map(int,raw_input().split())
        tmp+=prev_x*y - prev_y*x
        prev_x, prev_y=x, y
    tmp+=prev_x*y0 - prev_y*x0
    print c, 0.5*abs(tmp)
    skip=raw_input()
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)

N,M=map(int,input().split())
S=input()
T=input()
L=N*M//gcd(N,M)
n=L//N
m=L//M
l=n*m//gcd(n,m)
i=l//n
j=l//m
for k in range(N//i):
    if S[i*k]==T[j*k]:
        continue
    else:
        print(-1)
        sys.exit()
print(L)

### FIXED CODE ###

import sys
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)

N,M=map(int,input().split())
S=input()
T=input()
L=N*M//gcd(N,M)
n=L//N
m=L//M
l=n*m//gcd(n,m)
i=l//n
j=l//m
for k in range(N//i):
    if S[i*k]==T[j*k]:
        continue
    else:
        print(-1)
        sys.exit()
print(L)
if S <= W:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

S, W = map(int, input().split())

if S <= W:
  print("unsafe")
else:
  print("safe")
n = input()
n = int(n)
l=[]
l=input().split(" ")
maximum=l[0]
c=1
for i in range(1,n):
	if(l[i]>=maximum):
		maximum=l[i]
		c=c+1
print(c)

### FIXED CODE ###

n = input()
n = int(n)
l=[i for i in map(int,input().split())]
maximum=l[0]
c=0
for i in range(n):
	if(l[i]>=maximum):
		maximum=l[i]
		c=c+1
print(c)
A, B, C, D = map(int, input().split())
p = 0
cntC = int(B / C) - int(A / C)
cntD = int(B / D) - int(A / D)

#a,bの最大公約数
def gcd(C, D):
    while D:
        C, D = D, C % D
    return C

#a,bの最小公倍数
def lcm(C, D):
    return C * D // gcd (C, D)


CD = lcm(C, D)

cntCD = int(B / CD) - int(A / CD)

# print(cntC, cntD, cntCD, CD)
calc = (B-A+1) - (cntC + cntD - cntCD)

if (A % C) == 0 and (B % D) == 0:
        calc -= 1

print(calc)

### FIXED CODE ###

S = list((input()))
fl = True

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        fl = False

if fl == True:
    print('Good')
else:
    print('Bad')
X,Y = input().split()
if int(X, 16) = int(Y, 16):
    print('=')
elif int(X, 16) > int(Y, 16):
    print('>')
else:
    print('<')

### FIXED CODE ###

X, Y = input().split()
if int(X, 16) > int(Y, 16):
    print('>')
elif int(X, 16) < int(Y, 16):
    print('<')
else:
    print('=')
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = list(map(int, input().split()))
a = [i for i in range(1,101)]
b = list(set(a) - set(p))
for i in range(len(b)):
  if x < b[i]:
    if abs(b[i-1]-x) <= abs(b[i]-x):
      print(b[i-1])
      break
    else:
      print(b[i])
      break
print(x-b[-1])

### FIXED CODE ###

x, n = map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = list(map(int, input().split()))
a = [i for i in range(201)]
b = sorted(list(set(a) - set(p)))
min_v = 1000
min_id = 0
for i in range(len(b)):
  if abs(x - b[i]) < min_v:
    min_v = abs(x - b[i])
    min_id = i
print(b[min_id])
n=int(input())
a=(input().split())
for i in range(n):
    x=0
    for j in range(n):
        for k in range(n):
            if j>k and a[j]==a[k] and j!=i and k!=i:
                x=x+1
    print(x)


### FIXED CODE ###

def main():
    from collections import Counter
    n=int(input())
    a=list(map(int,input().split()))

    ctr = Counter(a)
    frm_n = sum(x * (x - 1) // 2 for x in ctr.values())

    ans = []
    for x in a:
        ans.append(frm_n - ctr[x] + 1)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
L = [A[0]]
R = [A[-1]]

for i in range(N-1):
    L.append(gcd(L[-1], A[i+1]))
    R.append(gcd(R[-1], A[N-i-2]))
    print(L, R)
ans = max(L[-2], R[-2])
for i in range(1, N-1):
    ans = max(ans, gcd(L[i-1], R[-i-2]))

print(ans)

### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
L = [A[0]]
R = [A[-1]]

for i in range(N-1):
    L.append(gcd(L[-1], A[i+1]))
    R.append(gcd(R[-1], A[N-i-2]))

ans = max(L[-2], R[-2])
for i in range(1, N-1):
    ans = max(ans, gcd(L[i-1], R[-i-2]))

print(ans)