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

import queue
from collections import Counter

N,X,Y=map(int,input().split())
q=queue.Queue()
c=Counter()

for i in range(1,N+1):
    dist=[-1]*(N+1)#indexと頂点の番号を合わせる
    q=queue.Queue()
    q.put([i,0])
    dist[i]=0
    while not q.empty():
        j,kyori=q.get()

        if j-1>=1:
            if dist[j-1]==-1:
                q.put([j-1,kyori+1])
                dist[j-1]=kyori+1

        if j+1<=N:
            if dist[j+1]==-1:
                q.put([j+1,kyori+1])
                dist[j+1]=kyori+1
        
        if j == X and dist[Y]==-1:
            q.put([Y,kyori+1])
            dist[Y]=kyori+1

        if j == Y and dist[X]==-1:
            q.put([X,kyori+1])
            dist[X]=kyori+1

    c.update(Counter(dist[1:]))

ans=list(c.items())
ans.sort()
lenans=len(ans)
for i in range(1,N):
    if i<=lenans-1:
        print(ans[i][1]//2)
    else:
        print(0)

### FIXED CODE ###

from collections import deque
N,X,Y=map(int,input().split())

count=[0]*N

def bfs(start):
    dist=[-1]*(N+1)#indexと頂点の番号を合わせる
    q=deque()
    q.append([start,0])
    dist[start]=0
    while q:
        j,kyori=q.popleft()

        if j-1>=1:
            if dist[j-1]==-1:
                q.append([j-1,kyori+1])
                dist[j-1]=kyori+1

        if j+1<=N:
            if dist[j+1]==-1:
                q.append([j+1,kyori+1])
                dist[j+1]=kyori+1
        
        if j == X and dist[Y]==-1:
            q.append([Y,kyori+1])
            dist[Y]=kyori+1

        if j == Y and dist[X]==-1:
            q.append([X,kyori+1])
            dist[X]=kyori+1

    return dist[1:]

def main():
    for start in range(1,N+1):
        dist=bfs(start)
        for d in dist:
            count[d]+=1

    for i in count[1:]:
        print(i//2)

main()
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
r = list(map(int,input().split()))
l1 = max(l)
r1 = max(r)
left = 1
if l[0] == l1:left = 0

right = n-2
if r[-1] == l1:right = n-1

res = 1
if l1 != r1:print(0)
else:
    while l[left] != l1:
        if l[left] == l[left-1]:
            res *= l[left]%1000000007
        left += 1
    while r[right] != r1:
        if r[right] == r[right+1]:
            res *= r[right]%1000000007
        right -=1

    if  left > right:print(0)
    else:
        if  left < right:
            res *= l1**(right-left-1)

        print(res%1000000007)




### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
r = list(map(int,input().split()))
l1 = max(l)
r1 = max(r)
left = 1
if l[0] == l1:left = 0

right = n-2
if r[-1] == l1:right = n-1

res = 1
if l1 != r1:print(0)
else:
    while l[left] != l1:
        if l[left] == l[left-1]:
            res = (res*l[left])%1000000007
        left += 1
    while r[right] != r1:
        if r[right] == r[right+1]:
            res = (res*r[right])%1000000007
        right -=1

    if  left > right:print(0)
    else:
        if  left < right:
            for i in range(right-left-1):
                res = (res*l1)%1000000007

        print(res%1000000007)
### BUGGY CODE ###

N = int(input())
S = input()
ans = 0
for k in range(N-1):
    for l in range(k+1,N):
        if S[k] == S[l]:
            temp = 1
            i, j = k+1, l+1
            while i < l and j < N:
                if S[i] == S[j]:
                    temp += 1
                    i += 1
                    j += 1
                else:
                    break
            ans = max(ans,temp)
print(ans)


### FIXED CODE ###

import sys

def main():
    def input():
        return sys.stdin.readline()
    N = int(input())
    S = "_" + input()

    dp = [[0 for k in range(N+1)] for l in range(N+1)]

    for k in range(1,N):
        for l in range(k+1,N+1):
            if S[k] == S[l]:
                dp[k][l] = dp[k-1][l-1] + 1
    ans = 0
    for k in range(1,N):
        for l in range(k+1,N+1):
            if l-k >= dp[k][l]:
                ans = max(ans,dp[k][l])

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

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

c = 0

for i in range(0,n):
#  print(i,a[i],a[0:i+1])
  if a[i] == min(a[0:i+1]):
   c+=1
print(c)


### FIXED CODE ###

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

x=a[0]

for i in range(0,n):
  if x >= a[i]:
#    print(a[i])
    x=a[i]
    c+=1
print(c)
### BUGGY CODE ###

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

A,B=[0]*M,[0]*M
route=[[float("inf")]*N for _ in range(N)]
for i in range(M):
    A[i],B[i]=map(int,input().split())
    A[i]-=1
    B[i]-=1
    route[A[i]][B[i]]=1
    route[B[i]][A[i]]=1

visited=1
not_visited=0

size=len(route)
cost=[float("inf") for _ in range(size)]
visited=[not_visited for _ in range(size)]
before=[None for _ in range(size)]
cost[0]=0

while True:
    MIN=float("inf")
    for i in range(size):
        if visited[i]==not_visited and cost[i]<MIN:
            x = i
            MIN = cost[x]
    if MIN == float("inf"):
        break
    visited[x] = visited

    for i in range(size):
        if cost[i]>route[x][i]+cost[x]:
            cost[i]=route[x][i]+cost[x]
            before[i]=x


def count(start,before):
    now=start
    ret=1
    while True:
        if before[now]==0:
            break
        else:
            ret+=1
            now=before[now]
    return ret

for i in range(1,N):
    if count(i,before)==cost[i]:
        continue
    else:
        print("No")
        exit()

print("Yes")
for i in range(1,N):
    print(before[i]+1)

### FIXED CODE ###

from collections import deque

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

graph=[[] for _ in range(N)]
for i in range(M):
    A,B=map(int,input().split())
    A-=1
    B-=1
    graph[A].append(B)
    graph[B].append(A)

def bfs(maze,start):
    queue=deque([start])
    d=[float("inf")]*N
    d[start]=0
    while queue:
        x=queue.popleft()
        for y in graph[x]:
            if d[y]==float("inf"):
                d[y]=d[x]+1
                queue.append(y)
    return d

d=bfs(graph,0)
ans=[0]*N
for i in range(1,N):
    flag=0
    for vertex in graph[i]:
        if d[vertex]==d[i]-1:
            ans[i]=vertex+1
            flag=1
            break
    if flag==0:
        print("No")
        exit()
print("Yes")
print(*ans[1:])
### BUGGY CODE ###

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

a=[]

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

b=[map(int,raw_input().split() )for i in range(m)]

for i in range(m):
    a.sort()
    for j in range(b[i][0]):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
        else:
           break
print(sum(a))

### FIXED CODE ###

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

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,min(n,k+b[i][0])):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
    if k==n:
        k=n-1
print(sum(a))
### BUGGY CODE ###

import math
a, b, n = map(int, input().split())

r = n // b
ans = 0

for i in range(1, r + 1):
    t = i * b - 1
    ans_t = a * t // b - (a * (i - 1))
    ans = max(ans, ans_t) 
    # print(i, t, ans)

ans_t = a * n // b - (a * (n // b))
ans = max(ans, ans_t) 

print(ans)

### FIXED CODE ###

import sys
a, b, n = map(int, input().split())

if n < b:
    ans = a * n // b  
    print(ans)
    sys.exit()  
elif n == b:
    ans = a * (b-1) // b
    print(ans)
    sys.exit()

# n == 1のときは0 問題なし
r = n // b
ans = 0
# for i in range(1, r + 1):
#     t = i * b - 1
#     ans_t = a * t // b - (a * (i - 1))
#     ans = max(ans, ans_t) 
    # print(i, t, ans)

t = r * b - 1
ans_t = a * t // b - (a * (r - 1))
ans = max(ans, ans_t) 

ans_t = a * n // b - (a * (n // b))
ans = max(ans, ans_t) 

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

from collections import defaultdict
from heapq import heappop, heappush,heapify
import sys
input = sys.stdin.buffer.readline

N,M,S = map(int,input().split())
UVAB = [list(map(int,input().split())) for i in range(M)]
U,V,A,B = zip(*UVAB)
mc = max(A)* M
g = defaultdict(list)

for u,v,a,b in UVAB:
    for i in range(a,mc+1):
        g[(u,i)].append(((v,i-a),b))
        g[(v,i)].append(((u,i-a),b))
CD = [[0,0]] + [list(map(int,input().split())) for i in range(N)]
C,D = zip(*CD)

for i in range(1,N+1):
    for c in range(mc+1-C[i]):
        g[(i,c)].append(((i,c+C[i]),D[i]))

S = min(S,mc)
dq = [(0,1,S)]

ans = [[10**15 for j in range(mc+1)] for i in range(N+1)]
while dq:
    t, v, w = heappop(dq)
    if ans[v][w] < t:
        continue
    ans[v][w] = t
    for (nv,nw), nt in g[(v,w)]:
        if ans[nv][nw] > t + nt:
            heappush(dq,(t+nt,nv,nw))

for i in range(2,N+1):
    print(min(ans[i]))





### FIXED CODE ###

from collections import defaultdict
from heapq import heappop, heappush,heapify
import sys
input = sys.stdin.readline

N,M,S = map(int,input().split())
UVAB = [list(map(int,input().split())) for i in range(M)]
U,V,A,B = zip(*UVAB)

'''
from itertools import combinations 
N = 14
M = N*(N-1)//2
S = 0
UVAB = [[x,y,50,10**9] for x,y in combinations(range(1,N+1),2)] 
U,V,A,B = zip(*UVAB)
'''

mc = max(A)* M
g = defaultdict(list)

for u,v,a,b in UVAB:
    for i in range(a,mc+1):
        g[(u,i)].append(((v,i-a),b))
        g[(v,i)].append(((u,i-a),b))

CD = [[0,0]] + [list(map(int,input().split())) for i in range(N)]
#CD = [[0,0]] + [[10**9,10**9] for i in range(N)]
C,D = zip(*CD)
C = [min(c,mc) for c in C]

for i in range(1,N+1):
    for c in range(mc+1-C[i]):
        g[(i,c)].append(((i,c+C[i]),D[i]))

S = min(S,mc)
dq = [(0,S,1)]

ans = [[10**15 for j in range(mc+1)] for i in range(N+1)]
while dq:
    t, w, v = heappop(dq)
    if ans[v][w] <= t:
        continue
    for i in range(w+1):
        ans[v][i] = min(t, ans[v][i])
    for (nv,nw), nt in g[(v,w)]:
        if ans[nv][nw] > t + nt:
            heappush(dq,(t+nt,nw,nv))

for i in range(2,N+1):
    print(min(ans[i]))
### BUGGY CODE ###

s = input()
q = int(input())

roll = False
ans = [s]
preNum = 0

for i in range(q) :
    inp = input()
    if inp[:1] == '1' :
        roll = not roll
        #print(roll)
    else :
        t, f, c = inp.split()
        #print(ans)
        #print(t, f, c)
        if (f == '1' and (not roll)) or (f == '2' and roll) :
            ans = ans[::-1]
            #print(ans, 'rev')
            ans.append(c)
            #print(ans, '+C')
            ans = ans[::-1]
            #print(ans, 'ver')
            preNum += 1
        else :
            ans.append(c)
#print(ans)
if roll :
    ans[preNum] = ans [preNum][::-1]
    ans = ans[::-1]

#print(ans)

print("".join(ans))


### FIXED CODE ###

from collections import deque

s = input()
q = int(input())

roll = False
ans = deque([s])
preNum = 0

for i in range(q) :
    inp = input()
    if inp[:1] == '1' :
        roll = not roll
        #print(roll)
    else :
        t, f, c = inp.split()
        #print(ans)
        #print(t, f, c)
        if (f == '1' and (not roll)) or (f == '2' and roll) :
            ans.appendleft(c)
            preNum += 1
        else :
            ans.append(c)
#print(ans)
ans = list(ans)
if roll :
    ans[preNum] = ans[preNum][::-1]
    ans = ans[::-1]

#print(ans)
#print("".join(ans))
for s in ans :
    print(s, end='')
### BUGGY CODE ###

x,y = map(int,input().split())
nums = []
n = 0
for i in range(x,y + 1):
    if i == x * pow(2,n) and i <= y:
        nums.append(i)
        n += 1
print(len(nums))

### FIXED CODE ###

x,y = map(int,input().split())
cnt = 1
while(x <= y):
    x *= 2
    cnt += 1
print(cnt - 1)
### BUGGY CODE ###

n,m=(int(i) for i in input().split())
a=[0 for i in range(n+m)]
b=[int(i) for i in input().split()]
for i in range(n):
  k=(b[i]+1)/2
  for j in range(m):
    a[i+j]+=k
print(max(a))

### FIXED CODE ###

n,m=(int(i) for i in input().split())
l=[]
for i in input().split():
  l.append((int(i)+1)/2)
s=sum(l[0:m])
maxe=s
for i in range(n-m):
  s+=l[m+i]
  s-=l[i]
  if s>maxe:
    maxe=s
print(maxe)
### BUGGY CODE ###

import sys
import heapq
from collections import deque
#input = sys.stdin.readline

def main():        
    h,w=map(int,input().split())
    s=[[]*w for _ in range(h)]
    for i in range(h):
        s[i]=list(input())
    chk=deque()
    d=[[0,1],[0,-1],[1,0],[-1,0]]

    def bfs(x,y):
        ans,dist=0,0
        a=[[-1]*w for _ in range(h)]
        chk=[(x,y,0)]
        a[x][y]=0
        while chk:
            x,y,dist=chk.pop(0)
            bx,by=x,y
            a[x][y]=dist
            for dx,dy in d:
                x=dx+bx
                y=dy+by
                if x>=0 and y>=0 and x<=h-1 and y<=w-1:
                    if s[x][y]=='.' and a[x][y]==-1:
                        chk.append([x,y,dist+1])
        ans=0
        for i in range(h):
                ans=max(ans,max(a[i]))
        return ans
    
    ans=0
    for i in range(h):
        for j in range(w):
            if s[i][j]=='#':
                continue
            ans=max(ans,bfs(i,j))
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import heapq
from collections import deque
input = sys.stdin.readline

def main():        
    h,w=map(int,input().split())
    s=[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 s[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 s[i][j]=='#':
                continue
            ans=max(ans,bfs(i,j))
    print(ans)

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

n = int(input())
a = list(map(int, input().split()))
ans = [a[0]]
if n%2==0:
    for i in range(1,n):
        if i%2==0:
            ans.append(a[i])
        else:
            ans.insert(0,a[i])
else:
    for i in range(1,n):
        if i%2==0:
            ans.insert(0,a[i])
        else:
            ans.append(a[i])
print(*ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
index = [0]*n
if n%2==0:
    m = n//2
    for i in range(n):
        if i%2==0:
            index[m+i//2] = i
        else:
            index[m-(i+1)//2] = i
else:
    m = (n-1)//2
    for i in range(n):
        if i%2==0:
            index[m-i//2] = i
        else:
            index[m+(i+1)//2] = i

ans = [0]*n
for i in range(n):
    ans[i] = a[index[i]]
print(*ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(S, Q, Qvery):
    fw = True
    for qvery in Qvery:
        if qvery[0] == 1:
            if fw:
                fw = False
            else:
                fw = True
        elif qvery[0] == 2:
            if qvery[1] == 1 and fw or qvery[1] == 2 and not fw:  # 先頭に追加
                S = qvery[2] + S
            else:  # 末尾に追加
                S = S + qvery[2]
        else:
            print("Parse error")

    if fw:
        print(S)
    else:
        rev_str = S[::-1]
        print(rev_str)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    Qvery = []
    for i in range(Q):
        T = int(next(tokens))
        if T == 1:
            Qvery.append([1])
        elif T == 2:
            Qvery.append([2, int(next(tokens)), str(next(tokens))])
    solve(S, Q, Qvery)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(S, Q, Qvery):
    pool = []
    fw = True
    for qvery in reversed(Qvery):
        if qvery[0] == 1:
            if fw:
                fw = False
            else:
                fw = True
        else:
            if qvery[1] == 1 and fw or qvery[1] == 2 and not fw:  # 先頭に描く
                print(qvery[2], end='')
            else:
                pool.append(qvery[2])

    if fw:
        print(S, end='')
    else:
        rev_S = S[::-1]
        print(rev_S, end='')
    for p in reversed(pool):
        print(p, end='')
    print()

    # fw = True
    # ret = list(S)
    # # ret.append(S)
    # for qvery in Qvery:
    #     if qvery[0] == 1:
    #         # fw = not fw
    #         if fw:
    #             fw = False
    #         else:
    #             fw = True
    #     else:
    #         if qvery[1] == 1 and fw or qvery[1] == 2 and not fw:  # 先頭に追加
    #             ret.insert(0, qvery[2])
    #             # S = qvery[2] + S
    #         else:  # 末尾に追加
    #             ret.append(qvery[2])
    #             # S = S + qvery[2]

    # if fw:
    #     print(''.join(ret))
    # else:
    #     rev_ret = ret[::-1]
    #     print(''.join(rev_ret))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    Qvery = []
    for i in range(Q):
        T = int(next(tokens))
        if T == 1:
            Qvery.append([1])
        elif T == 2:
            Qvery.append([2, int(next(tokens)), str(next(tokens))])
    solve(S, Q, Qvery)

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

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

for i in range(N):
    print(As.count(i+1))

### FIXED CODE ###

N = int(input())
As = list(map(int, input().split()))
ans = [0] * N

for i in As:
    ans[i-1]+=1

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

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

dp = [[0 for j in range(i+1)] for i in range(N+1)]
dp[0][0] = 1

for i in range(N) :
    for j in range(i+1) :
        dp[i+1][j+1] += dp[i][j] * P[i]
        dp[i+1][j] += dp[i][j] * (1 - P[i])

ans = 0
for i in range(N+1) :
    if i > N/2 :
        ans += dp[N][i]
print(ans)


### FIXED CODE ###

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

dp = [[0 for j in range(i+1)] for i in range(N+1)]
dp[0][0] = 1

for i in range(N) :
    for j in range(i+1) :
        dp[i+1][j+1] += dp[i][j] * P[i]
        dp[i+1][j] += dp[i][j] * (1 - P[i])

ans = 0
for i in range(N+1) :
    if i > N/2 :
        ans += dp[N][i]
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()

start = s.find("#")
end = s.rfind(".")
black_index = [j for j in range(len(s[start:end+1])) if s[j] =="#"]
white_index = [j for j in range(len(s[start:end+1])) if s[j] =="."]

if len(black_index) == 0 or len(white_index) ==0:
    print(0)
else:
    black_new_index = [black_index[j] for j in range(len(black_index)) if black_index[j]+1 not in black_index]
    white_new_index = [white_index[j] for j in range(len(white_index)) if white_index[j]+1 not in white_index]
    print(min(max(len(black_new_index),1), max(len(white_new_index),1)))

### FIXED CODE ###

n = int(input())
s = input()
black = s[:0].count("#")
white = s[0:].count(".")
count = [black+white]    
    
for i in range(1, n+1):
    if s[i-1]== "#":
        black +=1
    else:
        white -=1
    count.append(white+black)
    
print(min(count))
### BUGGY CODE ###

# coding: utf-8
# Your code here!
N=int(input())
S=list(map(int,input().split()))

S1=[]
for i in range(N):
    S1.append(S[i])
S1.sort()
chuouchi=S1[len(S1)//2]
chuouchi2=S1[len(S1)//2-1]
ans=10**18
ansj=0
A=chuouchi-N//2-5
B=chuouchi-N//2+5
C=chuouchi2-N//2-10
D=chuouchi2-N//2+10
for i in range(A,B):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei
        
for i in range(C,D):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei
        
        
print(ans)


### FIXED CODE ###

# coding: utf-8
# Your code here!
import statistics

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

S1=[]
for i in range(N):
    S1.append(S[i]-i)
S1.sort()
chuouchi=statistics.median_high(S1)
chuouchi2=statistics.median_low(S1)
chuouchi3=statistics.median(S1)
ans=10**20
ansj=0
A=chuouchi-4
B=chuouchi+4
C=chuouchi2-4
D=chuouchi2+4
E=int(chuouchi3)-4
F=int(chuouchi3)+4
for i in range(A,B):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei
        
for i in range(C,D):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei

for i in range(E,F):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei        
        
print(ans)
### BUGGY CODE ###

N = int(input())

import fractions
#import math
from functools import reduce
def lcm_base(x, y):
  return (x * y) // fractions.gcd(x, y)
  #return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

for h in range(1, 3501):
    for n in range(1, 3501):
        l = lcm_list([N, h, n])
        x = 4*(l//N)-l//h-l//n
        if x <= 0:
            continue
        else:
            if l%x == 0:
                print(h, n, l//x)
                exit()


### FIXED CODE ###

N = int(input())

for h in range(1, 3501):
    for n in range(h, 3501):
        x = 4*h*n-N*n-N*h
        if x <= 0:
            continue
        else:
            if (N*h*n)%x == 0:
                print(h, n, (N*h*n)//x)
                exit()
### BUGGY CODE ###

import collections
n=int(input())
a=list(map(int,input().split()))
c = collections.Counter(a)

#print(c.most_common())

a1=len(list(set(a)))

for i in range(n):
    ans=0
    for j in range(len(c)):
        if c.most_common()[j][1]>1:
    #登場回数が１以上の要素について考える
            if c.most_common()[j][0]==a[i]:
                x=c.most_common()[j][1]-1
            else:
                x=c.most_common()[j][1]
            ans+=x*(x-1)/2
    print(int(ans))

### FIXED CODE ###

import collections 
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
c=defaultdict(int)
for s in a:
    c[s]+=1

a1=list(set(a))

total=0
for j in range(len(a1)):
    x=c[a1[j]]
    total+=x*(x-1)/2

for i in range(n):
    ans=total-c[a[i]]+1
    print(int(ans))
### BUGGY CODE ###

n = int(input())
li_a = list(map(int, input().split()))
answer = 0
mo = (10 ** 9) + 7
for idx, a in enumerate(li_a):
    answer += (a * sum(li_a[idx + 1:]))
print(answer % mo)

### FIXED CODE ###

n = int(input())
li_a = list(map(int, input().split()))
answer = 0
su = sum(li_a)
mo = (10 ** 9) + 7
for idx, a in enumerate(li_a):
    su = su - a
    answer += (a * su)
print(answer % mo)
### BUGGY CODE ###

h=int(input())
count=1
ans=1
v=h
while True:
    temp=v//2
    #count=count*2
    #ans+=count
    if temp==1:
        #count=count*2
        ans+=1
        #ans+=count
        break
    v=temp
    #count=count*2
    #ans+=count
    ans+=1
    
print(int((1-2**ans)/(1-2)))




### FIXED CODE ###

h=int(input())
count=1
ans=1
v=h
import math
while True:
    temp=math.floor(v/2)
    if temp==0:
        #count=count*2
        #ans+=1
        #ans+=count
        break
    v=temp
    ans+=1
    
print(int((1-2**(ans))/(1-2)))