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

n = int(input())
a = list(map(int,input().split()))	
cnt=0
for i in range(n):
    for j in range(n-i):
        j+=i+1
        if sum(a[i:j])==0:
            cnt+=1
print(cnt)






### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
s=[0 for _ in range(n+1)]
for i in range(n):
    s[i+1]+=s[i]+a[i]
s.sort()
c=1
cnt=0
for i in range(n):
    if s[i]==s[i+1]:
        cnt+=c
        c+=1
    else:
        c=1
print(cnt)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

def m():
    H, W = map(int, input().split())
    S = []
    for i in range(H):
        S.append(list(input()))

    graph = [[[]for _ in range(W)] for _ in range(H)]
    visited = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                continue
            if S[max(i - 1, 0)][j] == ".":
                graph[max(i - 1, 0)][j].append((i,j))
                graph[i][j].append((max(i - 1, 0),j))

            if S[min(i+1, H-1)][j] == ".":
                graph[min(i + 1, H - 1)][j].append((i,j))
                graph[i][j].append((min(i + 1, H - 1),j))

            if S[i][max(j - 1, 0)] == ".":
                graph[i][max(j - 1, 0)].append((i,j))
                graph[i][j].append((i,max(j - 1, 0)))

            if S[i][min(j+1, W-1)] == ".":
                graph[i][min(j + 1, W - 1)].append((i,j))
                graph[i][j].append((i,min(j+1, W-1)))

    bw = [0] * 2
    def dfs(g):
        for a,b in g:
            if visited[a][b] == 1:
                continue
            visited[a][b] = 1
            if S[a][b] == ".":
                bw[0] += 1
            else:
                bw[1] += 1
            dfs(graph[a][b])

    ans = 0
    for i in range(H):
        for j in range(W):
            if visited[i][j] == 1:
                continue
            bw[0], bw[1] = 0, 0
            dfs(graph[i][j])
            ans += bw[0] * bw[1]

    return ans

print(m())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def m():
    H, W = map(int, input().split())
    S = []
    for i in range(H):
        S.append(list(input()))

    graph = [[[]for _ in range(W)] for _ in range(H)]
    visited = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                continue
            if S[max(i - 1, 0)][j] == ".":
                graph[max(i - 1, 0)][j].append((i,j))
                graph[i][j].append((max(i - 1, 0),j))

            if S[min(i+1, H-1)][j] == ".":
                graph[min(i + 1, H - 1)][j].append((i,j))
                graph[i][j].append((min(i + 1, H - 1),j))

            if S[i][max(j - 1, 0)] == ".":
                graph[i][max(j - 1, 0)].append((i,j))
                graph[i][j].append((i,max(j - 1, 0)))

            if S[i][min(j+1, W-1)] == ".":
                graph[i][min(j + 1, W - 1)].append((i,j))
                graph[i][j].append((i,min(j+1, W-1)))

    bw = [0] * 2
    def dfs(g):
        for a,b in g:
            if visited[a][b] == 1:
                continue
            visited[a][b] = 1
            if S[a][b] == ".":
                bw[0] += 1
            else:
                bw[1] += 1
            dfs(graph[a][b])

    ans = 0
    for i in range(H):
        for j in range(W):
            if visited[i][j] == 1:
                continue
            bw[0], bw[1] = 0, 0
            dfs(graph[i][j])
            ans += bw[0] * bw[1]

    return ans

print(m())
### BUGGY CODE ###

a, b = map(int, input().split())
w = input()
for i in range(b):
  w1 = ""
  c, d = map(int, input().split())
  for j in range(c-1,d):
    w1 += w[j]
  print(w1.count("AC"))

### FIXED CODE ###

n,q = map(int,input().split())
s = list(input())

#a[i]:s[0]~s[i]までに何個ACがあったか
a = [0]*n
#end[i]:s[i]がACの'C'か
end = [False]*n
for i in range(1,n):
    if s[i] == 'C' and s[i-1] == 'A':
        a[i] = a[i-1]+1
        end[i] = True
    else:
        a[i] = a[i-1]
for i in range(q):
    L,R = map(int,input().split())
    L,R = L-1,R-1
    if L == 0:
        print(a[R])
    else:
        if end[L]:
            print(a[R]-a[L-1]-1)
        else:
            print(a[R]-a[L-1])
### BUGGY CODE ###

# https://atcoder.jp/contests/abc147/tasks/abc147_d
n = int(input())
nums = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += (nums[i] ^ nums[j]) % mod

print(ans % mod)

### FIXED CODE ###

# https://atcoder.jp/contests/abc147/tasks/abc147_d
n = int(input())
nums = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

ans = 0
one = [0] * 61
zero = [0] * 61

for i in range(61):
    for num in nums:
        if (num >> i) & 1:
            one[i] += 1
        else:
            zero[i] += 1
ans = 0
for k in range(61):
    ans = (ans + (one[k] * zero[k] * (1 << k))) % mod
print(ans % mod)
### BUGGY CODE ###

def merge(a, l, m, r):
    global cnt
    n1, n2 = m - l, r - m
    ll = list(a[l + i] for i in range(n1))
    rl = list(a[m + i] for i in range(n2))
    ll.append(1e9 + 1)
    rl.append(1e9 + 1)
    i, j = 0, 0
    for k in range(l, r):
        if ll[i] < rl[j]:
            a[k] = ll[i]
            i += 1
        else:
            a[k] = rl[j]
            j += 1
        cnt += 1


def merge_sort(a, l, r):
    if l + 1 < r:
        m = (l + r) // 2
        merge_sort(a, l, m)
        merge_sort(a, m, r)
        merge(a, l, m, r)


n, a, cnt = int(input()), list(map(int, input().split())), 0
merge_sort(a, 0, n)
print(*a)
print(cnt)

### FIXED CODE ###

from collections import deque

INFTY = 1e9 + 1


def merge(a, l, m, r):
    global cnt
    ll = deque(a[l:m])
    rl = deque(a[m:r])
    ll.append(INFTY)
    rl.append(INFTY)
    for k in range(l, r):
        a[k] = (ll if ll[0] < rl[0] else rl).popleft()
    cnt += r - l


def merge_sort(a, l, r):
    if l + 1 < r:
        m = (l + r) // 2
        merge_sort(a, l, m)
        merge_sort(a, m, r)
        merge(a, l, m, r)


n, a, cnt = int(input()), list(map(int, input().split())), 0
merge_sort(a, 0, n)
print(*a)
print(cnt)
### BUGGY CODE ###

#AIsing2020 d

import sys,math,collections,itertools,copy
input = sys.stdin.readline


def popcount(n):
    bin_str = bin(n)
    cou1 = bin_str.count('1')
    return cou1

def count(nc):
    co = 0
    while nc >0:
        cou1 = popcount(nc)
        nc = nc%cou1
        co +=1
    return co

N = int(input())
X = list(input().rstrip())

for i in range(N):
    Y = copy.copy(X)
    if Y[i] == '1':
        Y[i] = '0'
    else:
        Y[i] = '1'
    s = '0b'+"".join(Y)
    a =int(s,2)
    co = count(a)
    print(co)
    


### FIXED CODE ###

#AIsing2020 d

def f(n):
        cnt = 0
        while n:
            cnt+= 1
            n = n%bin(n).count('1')
        return cnt

def main():
    N = int(input())
    X = input()
    X10 = int(X,2)
    X10_num1 = X.count('1')
    X10_pulse = X10%(X10_num1+1)
    X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


    for i in range(N,0,-1):
        j = N-i
        if (X[j] == '1') and X10_num1 >1:
            mod = X10_num1-1
            amari = (X10_ninus - pow(2,i-1,mod))%(mod) 
        elif (X[j] == '1') and X10_num1 ==1:
            print(0)
            continue
        else:
            mod = X10_num1+1
            amari = (X10_pulse + pow(2,i-1,mod))%(mod)

        print(1+f(amari))


main()
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  ans += i * int((int(n/i) + 1) * int(n/i) / 2)

print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  tmp = int(n/i)
  ans += i * tmp * (tmp + 1)

print(int(ans/2))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
i = 0
while 1:
    if i >= len(a):
        break
    if a[i] != i+1:
        a.pop(i)
    else:
        i += 1
if len(a) == 0:
    print(-1)
else:
    print(n-len(a))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
i = 0
j = 0
c = 0
while 1:
    if j >= len(a):
        break
    if a[j] != i+1:
        j += 1
        c += 1
    else:
        j += 1
        i += 1
if len(a) == c:
    print(-1)
else:
    print(c)
### BUGGY CODE ###

# coding: utf-8
N=int(input())
maxi=0
for i in range(1,N+1):
    if pow(i,2)<=N:
        maxi=pow(i,2)
print(maxi)

### FIXED CODE ###

# coding: utf-8
N=int(input())
maxi=0
for i in range(1,N+1):
    if pow(i,2)<=N:
        maxi=pow(i,2)
    else:
        break
print(maxi)
### BUGGY CODE ###

# python3


def main():
    # 2 <= N <= pow(10,5), 1 <= K <= 100
    N, K = [int(ele) for ele in input().split()]
    h = [Node(int(ele)) for ele in input().split()]
    cal_dp(h, K)
    print(h[-1].dp_val)


def cal_dp(h, K):
    for idx, n in enumerate(h):
        if idx == 0:
            n.dp_val = 0
        else:
            tmp = [pow(10, 5)] * (K)
            for jdx in range(1, K+1):
                if jdx <= idx:
                    f = h[idx-jdx].dp_val
                    diff = abs(h[idx].val - h[idx-jdx].val)
                    tmp[jdx-1] = f + diff
                else:
                    break

            n.dp_val = min(tmp)


class Node():

    def __init__(self, val):
        self.val = val
        self.dp_val = 'unk'


if __name__ == '__main__':
    main()


### FIXED CODE ###

# python3
import sys

input = sys.stdin.readline


def main():
    # 2 <= N <= pow(10,5), 1 <= K <= 100
    N, K = [int(ele) for ele in input().split()]
    h = [Node(int(ele)) for ele in input().split()]

    for idx, n in enumerate(h):
        s = max(0, idx - K)
        n.parents = h[s:idx]
        n.cal_dp()

    print(h[-1].dp_val)


class Node():

    def __init__(self, val):
        self.val = val
        self.dp_val = 1000000000000
        self.parents = []

    def cal_dp(self):
        if self.parents == []:
            self.dp_val = 0
            return

        for n in self.parents:
            self.dp_val = min(self.dp_val, abs(n.val - self.val)+n.dp_val)


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

n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
b=[]
if a[0]==a[-1]:
  print(n)
else:
  for i in range(a[0]-1,a[-1]+1):
    b+=[a.count(i)]
  for i in range(n+1):
    ans=max(ans,sum(b[i:i+3]))
  print(ans)

### FIXED CODE ###

import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
ans=1
for i in range(min(a),max(a)+1):
  goukei=c[i-1]+c[i]+c[i+1]
  ans=max(ans,goukei)
print(ans)
### BUGGY CODE ###

def main():
  import sys
  input=sys.stdin.readline
  h,w,k=map(int,input().split())
  tx,ty,sx,sy=map(int,input().split())
  b=[[-1]*(w+2)]
  for i in range(h):
    s=input()
    bb=[-1]
    for j in s:
      if j==".":bb.append(0)
      else:bb.append(-1)
    bb.append(-1)
    b.append(bb)
  b.append([-1]*(w+2))
  d=[]
  d.append((sx,sy))
  s=set()
  for ss in d:
    x,y=ss
    t=x*1000000+y
    if t in s:
      s.discard(t)
      continue
    if x==tx and y==ty:
      exit(print(b[x][y]))
    for i in range(1,k+1):
      if b[x+i][y]<=b[x][y] and b[x+i][y]!=0:break
      d.append((x+i,y))
      if b[x+i][y]!=0:
        s.add(t+1000000*i)
      b[x+i][y]=b[x][y]+1
    for i in range(1,k+1):
      if b[x-i][y]<=b[x][y] and b[x-i][y]!=0:break
      d.append((x-i,y))
      if b[x-i][y]!=0:
        s.add(t-1000000*i)
      b[x-i][y]=b[x][y]+1
    for j in range(1,k+1):
      if b[x][y+j]<=b[x][y] and b[x][y+j]!=0:break
      d.append((x,y+j))
      if b[x][y+j]!=0:
        s.add(t+j)
      b[x][y+j]=b[x][y]+1
    for j in range(1,k+1):
      if b[x][y-j]<=b[x][y] and b[x][y-j]!=0:break
      d.append((x,y-j))
      if b[x][y-j]!=0:
        s.add(t-j)
      b[x][y-j]=b[x][y]+1
  print(-1)
if __name__ == "__main__":
  main()


### FIXED CODE ###

import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
si,sj,ti,tj=map(int,input().split())
si-=1
sj-=1
ti-=1
tj-=1
b=[input()for _ in range(h)]
ans=[[-1]*w for _ in range(h)]
ans[si][sj]=0
from collections import deque
d=deque()
d.append((si,sj))
while d:
  x,y=d.popleft()
  if x==ti and y==tj:
    exit(print(ans[x][y]))
  for dx,dy in [[1,0],[-1,0],[0,-1],[0,1]]:
    for i in range(1,k+1):
      xx=x+dx*i
      yy=y+dy*i
      if not(0<=xx<h and 0<=yy<w) or b[xx][yy]=="@":break
      if 0<=ans[xx][yy]<=ans[x][y]:break
      if ans[xx][yy]==-1:d.append((xx,yy))
      ans[xx][yy]=ans[x][y]+1
print(-1)
### BUGGY CODE ###

N,W=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N+1)]
# dp[n][w] := n個の品物のうち上限の容量wのときの価値の最大値

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j>=w:
            dp[i][j]=max(dp[i-1][j-w]+v, dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
    
print(dp[-1][-1])

### FIXED CODE ###

N, W = map(int, input().split())
dp_pv = [0]*(W+1)

for i in range(N):
    w, v = map(int, input().split())
    
    dp = [dp_pv[j] if w > j else max(dp_pv[j], dp_pv[j-w]+v) for j in range(W+1)]
    dp_pv = dp
    #print(dp)
    
print(dp[-1])
### BUGGY CODE ###

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


# number_to_prime[i]: i の最小の素因数, iが素数ならば0
number_to_prime = [0] * (10**6 + 1)

# preprocess
for i in range(2, 10**6+1):
    if not number_to_prime[i]:
        j = 1
        while j*i <= 10**6:
            number_to_prime[j*i] = i
            j += 1


def is_pairwise():
    used_primes = set()
    pairwise_flag = 1
    for a in A:
        curr_primes = set()
        while a > 1:
            prime = number_to_prime[a]
            curr_primes.add(prime)
            a //= prime
        if used_primes & curr_primes:
            pairwise_flag = 0
            break
        else:
            used_primes = used_primes | curr_primes
    return pairwise_flag

def is_setwise(*A):
    import math
    from functools import reduce

    return reduce(math.gcd, A) == 1

if is_pairwise():
    print("pairwise coprime")
elif is_setwise(*A):
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

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


# number_to_prime[i]: i の最小の素因数, iが素数ならば0
number_to_prime = [0] * (10**6 + 1)

# preprocess
for i in range(2, 10**6+1):
    if not number_to_prime[i]:
        j = 1
        while j*i <= 10**6:
            number_to_prime[j*i] = i
            j += 1

def is_pair_copr(A):
    import numpy as np
    U = 1 << 20
    div_p = np.arange(U)
    for p in range(2, U):
        if div_p[p] != p:
            continue
        div_p[p::p] = p
    used = np.zeros(U, np.bool_)
 
    for x in A:
        while x > 1:
            p = div_p[x]
            while x % p == 0:
                x //= p
            if used[p]:
                return False
            used[p] = True
    return True

def is_pairwise():
    used_primes = set()
    pairwise_flag = 1
    for a in A:
        curr_primes = set()
        while a > 1:
            prime = number_to_prime[a]
            curr_primes.add(prime)
            a //= prime
        if used_primes & curr_primes:
            pairwise_flag = 0
            break
        else:
            used_primes = used_primes | curr_primes
    return pairwise_flag

def is_setwise(*A):
    import math
    from functools import reduce

    return reduce(math.gcd, A) == 1

if is_pair_copr(A):
    print("pairwise coprime")
elif is_setwise(*A):
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

H, W, M = map(int, input().split())
hw = []

h_cnt = [0] * H
w_cnt = [0] * W
hw = []
for _ in range(M):
    h, w = map(int, input().split())
    hw.append((h-1, w-1))
    h_cnt[h-1] += 1
    w_cnt[w-1] += 1

max_h = max(h_cnt)
max_w = max(w_cnt)
hs = [i for i in range(H) if h_cnt[i]==max_h]
ws = [i for i in range(W) if w_cnt[i]==max_w]

cnt = 0
for h, w in hw:
    if h in hs and w in ws:
        cnt += 1
if cnt < len(hs)*len(ws):
    print(max_h+max_w)
else:
    print(max_h+max_w-1)



### FIXED CODE ###

H, W, M = map(int, input().split())

h_cnt = [0] * H
w_cnt = [0] * W
hw = [tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)]
for h, w in hw:
    h_cnt[h] += 1
    w_cnt[w] += 1

max_h = max(h_cnt)
max_w = max(w_cnt)
hs = [i for i in range(H) if h_cnt[i]==max_h]
ws = [i for i in range(W) if w_cnt[i]==max_w]

ans = max_h+max_w-1
hw = set(hw)
for h in hs:
    for w in ws:
        if (h, w) not in hw:
            print(max_h+max_w)
            exit()
print(max_h+max_w-1)
### BUGGY CODE ###

s = str(input())
s=s[::-1]
mod = 2019
li = [0]*(len(s)+1)
cnt=1
for i in range(len(s)):
    li[i+1]=(li[i] + int(s[i]) * cnt) % mod
    cnt*=10
import collections
A=collections.Counter(li[1:])
ans=0
for u,v in A.items():
    ans+=v*(v-1)//2
    if u==0:
        ans+=v
print(ans)




### FIXED CODE ###

s = str(input())
s=s[::-1]
mod = 2019
li = [0]*(len(s)+1)
cnt=1
for i in range(len(s)):
    li[i+1]=li[i] + int(s[i]) * cnt
    li[i+1]%=mod
    cnt*=10
    cnt%=mod
import collections
A=collections.Counter(li[1:]);ans=0
for u,v in A.items():
    ans+=v*(v-1)//2
    if u==0:
        ans+=v
print(ans)
### BUGGY CODE ###

from collections import Counter
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
p, q, r = cnt[1], cnt[2], cnt[3]

dp = []
for _ in range(n + 1):
    dp.append([[0] * (r + 1) for _ in range(r + q + 1)])
dp[0][0][0] = 0

for k in range(r + 1):
    for j in range(r + q + 1):
        for i in range(n + 1):
            if (i + j + k == 0) or (i + j + k) > n:
                continue
            tmp = 0
            if i > 0:
                tmp += dp[i - 1][j][k] * i
            if (j > 0) and (i < n):
                tmp += dp[i + 1][j - 1][k] * j
            if (k > 0) and (j < r + q):
                tmp += dp[i][j + 1][k - 1] * k
            tmp += n
            dp[i][j][k] = tmp / (i + j + k)

print(dp[p][q][r])


### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N = NI()
a = [0,0,0]
for x in LI():
    a[x-1] += 1
dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]

for k in range(a[2]+1):
    for j in range(a[1]+a[2]+1):
        for i in range(N+1):
            if not (0 < i+j+k <= N): continue
            x = 0.0
            if i > 0: x += dp[i-1][j][k] * (i/N)
            if j > 0: x += dp[i+1][j-1][k] * (j/N)
            if k > 0: x += dp[i][j+1][k-1] * (k/N)
            x += 1.0
            x *= N / (i+j+k)
            dp[i][j][k] = x
print(dp[a[0]][a[1]][a[2]])
### BUGGY CODE ###

K,S = map(int,input().split())
counter = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == S:
        counter += 1
print(counter)

### FIXED CODE ###

K,S = map(int,input().split())
counter = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i - j
    if(k >= 0) and (k <= K):
      counter += 1
print(counter)
### BUGGY CODE ###

dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque

def main():
    h,w = map(int,input().split())
    grid = [input() for _ in range(h)]
    q = deque([])
    dist = [[-1] * w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if grid[i][j] == '#':
                dist[i][j] = 0
                q.append((i,j))
    
    ans = 0
    while q:
        i,j = q.popleft()
        for k in range(4):
            y = i + dy[k]
            x = j + dx[k]
            if y < 0 or y >= h:
                continue
            if x < 0 or x >= w:
                continue
            if dist[y][x] < 0:
                dist[y][x] = dist[i][j] + 1
                ans = max(ans,dist[y][x])
                q.append((y,x))
    print(ans)
if __name__ == '__main__':
    main()


### FIXED CODE ###

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque

def main():
    h,w = map(int,input().split())
    grid = [input() for _ in range(h)]
    dist = [[-1] * w for _ in range(h)]
    
    q = deque()
    for i in range(h):
        for j in range(w):
            if grid[i][j] == '#':
                q.append((i,j))
                dist[i][j] = 0
    
    ans = 0
    while q:
        i,j = q.popleft()
        for k in range(4):
            y = i + dy[k]
            x = j + dx[k]
            if 0 <= y < h and 0 <= x < w and dist[y][x] == -1:
                dist[y][x] = dist[i][j] + 1
                ans = max(ans,dist[y][x])
                q.append((y,x))
    
    print(ans)

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

n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = list(format(a[i],'0b').zfill(65))
g = [0 for i in range(65)]
for i in range(65):
    for j in range(n):
        if a[j][i] == '1':
            g[i] += 1
ans = 0
for i in range(len(g)):
    ans += g[i]*(n-g[i])*(2**(64-i))
    ans = ans%(10**9+7)
print(int(ans))

### FIXED CODE ###

import numpy as np

n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1) # 自分がnp.sumを利用したがどうしても正解になれなかった。なぜ？
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1

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

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

from pprint import pprint

l=[[False for _ in range(n)] for _ in range(n)]
v=[True for _ in range(n)]
for a,b in ab:
    l[b-1][a-1], l[a-1][b-1]=True,True

def dfs(x,t,v,j,m,n):
    j+=1
    if j<n+m:
        v[x]=False
        for i in range(1,n):
            if t[x][i]:
                dfs(i,t,v,j,m,n)

ans=0
for i in range(m):
    j=0
    t=[[False for _ in range(n)] for _ in range(n)]
    for a,b in ab:
        t[b-1][a-1],t[a-1][b-1]=True,True
    t[ab[i][1]-1][ab[i][0]-1],t[ab[i][0]-1][ab[i][1]-1]=False,False
    v=[True for _ in range(n)]
    if i!=0:
        dfs(ab[0][0]-1, t, v, j, m,n)
    else:
        dfs(ab[1][0]-1, t, v, j, m,n)
        
    z=False
    for x in v:
        if x:
            z=True
    if z:
        ans+=1
print(ans)


    

### FIXED CODE ###

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

from pprint import pprint

l=[[False for _ in range(n)] for _ in range(n)]
v=[True for _ in range(n)]
for a,b in ab:
    l[b-1][a-1], l[a-1][b-1]=True,True
def dfs(x,t,v,j,m,n):
    j+=1
    if j<n+m:
        v[x]=False
        for i in range(1,n):
            if v[i]:
                if t[x][i]:
                    dfs(i,t,v,j,m,n)
import copy

ans=0
for i in range(m):
    j=0
    t=copy.deepcopy(l)
    t[ab[i][1]-1][ab[i][0]-1],t[ab[i][0]-1][ab[i][1]-1]=False,False
    v=[True for _ in range(n)]
    dfs(0, t, v, j, m,n)
        
    z=False
    for x in v:
        if x:
            z=True
    if z:
        ans+=1
print(ans)
### BUGGY CODE ###

import sys
from heapq import heappush, heappop
 
 
def main():
    # n, x, y = 7, 3, 7
    n, x, y = [int(s) for s in sys.stdin.readline().strip().split()]
    score = {i: 0 for i in range(1, n)}
    total_pair = set()
 
    def bfs(start):
        seen = set()
        heap = [(0, start)]
        while heap:
            dist, cur = heappop(heap)
            pair = (min(start, cur), max(start, cur))
            if pair in seen:
                continue
            seen.add(pair)
            if dist > 0:
                if pair not in total_pair:
                    score[dist] += 1
                    total_pair.add(pair)
 
            if cur < n-1:
                heappush(heap, (dist+1, cur+1))
            if cur > 0:
                heappush(heap, (dist+1, cur-1))
            if cur == x-1:
                heappush(heap, (dist+1, y-1))
            if cur == y-1:
                heappush(heap, (dist+1, x-1))
 
    for i in range(n-1):
        bfs(i)
    for i in range(1, n):
        print(score[i])
 
main()

### FIXED CODE ###

import sys

def main():
    n, x, y = [int(s) for s in sys.stdin.readline().strip().split()]
    x1 = x-1
    y1 = y-1

    score = {i:0 for i in range(n)}

    for i in range(n-1):
        for j in range(i+1, n):
            diff = j - i
            cand = abs(x1 - i) + 1 + abs(y1 - j)
            cand2 = abs(y1 - i) + 1 + abs(x1 - j)
            result = min(diff, cand, cand2)
            score[result] += 1

    for i in range(1, n):
        print(score[i])

main()