peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x = int(input())
if x%11==0:
    print((x//11)*2)
elif 1<=x%11<=6:
    print((x//11)*2+1)
else:
    print((x//11)*2+2)
# Judge status: Accepted
K, S = map(int, input().split())

count = 0

for i in range(K + 1):
    for j in range(K + 1):

        if 0 <= S - i - j <= K:
            count += 1
print(count)
# Judge status: Accepted
def main():
    N = int(input())
    a = [int(x) for x in input().split()]

    mins = [0] * N
    mins[0] = a[0]
    for i in range(1, N):
        mins[i] = min(mins[i-1], a[i])
    # print(mins)
    ans = 0
    for i in range(N):
        ans += a[i] <= mins[i]
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# ABC124 A

def main():
    AB = list(map(int, input().split()))

    result = 0

    for i in range(2):
        max_num = max(AB)
        result += max_num
        AB[AB.index(max_num)] = max_num - 1
    
    print(result)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

if len(c) == 1 or len(c) == 2:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))

D = [None] * N
last = A[-1] - K
for i, a in enumerate(A):
  diff = (a - last, i)
  D[i] = diff
  last = a

i = max(D)[1]
if i == 0:
  print(A[i - 1] - A[i])
else:
  print(K - A[i] + A[i - 1])
# Judge status: Wrong Answer
k, x = map(int, input().split())
cost=500*k
if x >=cost:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b = map(int, input().split())
print(int((a+b)/2)) if (a+b)%2 == 0 else print("IMPOSSIBLE")
# Judge status: Wrong Answer
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
l=[l1,l2,l3]
for i in range(3):
    for j in range(3):
        l[i][j] -=l[0][0]
if (l[1][1]==l[0][1]+l[1][0]) and (l[2][1]==l[0][1]+l[2][0]) and (l[1][2]==l[0][2]+l[1][0])and (l[2][2]==l[2][0]+l[0][2]):
    print('Yes')
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())

s_list = {"AC": 0, "TLE": 0, "WA": 0, "RE": 0}

# a, t, w, r = 0, 0, 0, 0

for i in range(N):
  s = input()
  if s == "AC":
    s_list["AC"] += 1
  elif s == "TLE":
    s_list["TLE"] += 1
  elif s == "WA":
    s_list["WA"] += 1
  else:
    s_list["RE"] += 1
    

print("AC × {}\nTLE × {}\nWA × {}\nRE × {}".format(s_list["AC"], s_list["TLE"], s_list["WA"], s_list["RE"]))
# Judge status: Accepted
W = sorted(input())
n = len(W)
if n % 2 == 1:
    print('No')
    exit()

for i in range(0, n, 2):
    w1, w2 = W[i], W[i+1]
    if w1 != w2:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
n, m, k = map(int, input().split())
L = set()
for i in range(m + 1):
    for j in range(n + 1):
        c = n * i + m * j - i * j * 2
        if c >= 0:
            L.add(c)
if k in L:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
(h,n),*t=[[*map(int,t.split())]for t in open(0)]
d=[0]*9**8
for i in range(h):d[i+1]=min(b+d[i-a+1]for a,b in t)
print(d[h])
# Judge status: Accepted
s=input()
if s=='Sunny':
  print('Cloudy')
if s=='Cloudy':
  print('Rainy')
if s=='Rainy':
  print('Sunny')
# Judge status: Accepted
import math
s = int(input())

t = s // 3

ans = 0
for i in range(t):
  n = s - 3 * (i + 1) + i 
  ans += math.factorial(n) // (math.factorial(n - i) * math.factorial(i))

print(ans % (10**9+7))
# Judge status: Wrong Answer
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0]*w for _ in range(n)]
for i in range(n):
    for j in range(w):
        if j >= wv[i][0]:
            dp[i][j] = max(dp[i-1][j], wv[i][1] + dp[i-1][j-wv[i][0]+1])
        else:
            dp[i][j] = max(dp[i][j], dp[i-1][j])

print(max(dp[-1]))
# Judge status: Accepted
s = input() 
if s[-1]=="s":
  print(s+"es") 
else:
  print(s+"s")
# Judge status: Accepted
from math import ceil

N, H = map(int, input().split())
An, Bn = [0] * N, [0] * N
for i in range(N):
    An[i], Bn[i] = map(int, input().split())

ans = 0
a_max = max(An)
for b in sorted(Bn, reverse=True):
    if b < a_max:
        break
    H -= b
    ans += 1
    if H <= 0:
        break

if H > 0:
    ans += ceil(H/a_max)

print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    AB = [0] * N
    for i in range(N):
        AB[i] = map(int, input().split())

    n_press = 0
    for A, B in reversed(AB):
        r = (A + n_press) % B
        n_press += B - r if r > 0 else 0

    ans = n_press
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

sub1 = 0
sub2 = 0

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        sub2 += (b[i] - a[i]) // 2

if sub1 <= sub2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())

print(int(N*(N-1)/2+0.2))
# Judge status: Wrong Answer
d = int(input())

if d == 25:
    print("Chrirstmas")
if d == 24:
    print("Christmas Eve")
if d == 23:
    print("Christmas Eve Eve")
if d == 22:
    print("Christmas Eve Eve Eve")
# Judge status: Accepted
N = int(input())
def sup(N):
    indexa = 1
    sum = 0
    while True:
        sum += indexa
        if sum >= N:
            return indexa
        indexa +=1
ans = []
while True:
    k = sup(N)
    ans.append(k)
    N -=k
    if N == 0:
        break
ans.reverse()
n = len(ans)
for i in range(n):
    print(ans[i])
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *a = map(int, read().split())

set_a =  sorted(set(a))
if len(set_a) == 1:
    l = [set_a[-1]]*n
    print(*l)
    exit()
max_1 = set_a[-1]
max_2 = set_a[-2]
l = [max_2 if x == max_1 else max_1 for x in a]
print(*l)
# Judge status: Accepted
w, h, n = [int(i) for i in input().split()]

left = 0
right = w
upper = h
lower = 0

for i in range(n):
	x, y, a = [int(k) for k in input().split()]
	if a == 1 and left < x:
		left = x
	elif a == 2 and right > x:
		right = x
	elif a == 3 and lower < y:
		lower = y
	elif a == 4 and upper > y:
		upper = y

S = (right-left)*(upper-lower)
if right-left < 0 or upper-lower < 0:
	print(0)
else:
	print(S)
# Judge status: Wrong Answer

N, M, K = [int(_) for _ in input().split()]

for i in range(M+1):
    for j in range(N+1):
        if i *(M-j) + j *(N-i) == K:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
L = list(map(int, input().split()))
L.sort()

ans = L[2]-L[1]
L[0] = L[0]+ L[2]-L[1]
L[1] = L[2]
if L[0]%2 == L[2]%2:
    ans += (L[2]-L[0])//2
else:
    ans += 1 + (L[2]+1-L[0])//2
print(ans)
# Judge status: Accepted
x,a,b = map(int,input().split())
if a >= b:
    print("delicious")
elif a + x < b:
    print("dangerous")
else:
    print("safe")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

freq=dict()
for i in range(n):
    a[i]-=i
    try:
        freq[a[i]]+=1
    except:
        freq[a[i]]=1

ans =0
for i in range(n):
    try:
        ans+=freq[-a[i]-2*i]
    except:
        pass
    freq[a[i]]-=1

print(ans)
# Judge status: Accepted
n = int(input())
ab = []

for i in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))

if n % 2 == 1:
    ab.sort()
    min_val = ab[n//2][0]
    ab.sort(key=lambda x: -x[1])
    max_val = ab[n//2][1]
    print(max_val - min_val + 1)
else:
    ab.sort()
    min_val = ab[n//2][0] + ab[n//2 - 1][0]
    ab.sort(key=lambda x: -x[1])
    max_val = ab[n//2][1] + ab[n//2 - 1][1]
    print(max_val - min_val + 1)
# Judge status: Wrong Answer
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < a + 2 or a >= b:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
cnt = 0
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
  print(0)
  exit()
if a == b and b == c:
  print(-1)
  exit()
while cnt >= 0:
  if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    print(cnt)
    exit()
  else:
    a1 = (b + c) // 2
    b1 = (a + c) // 2
    c1 = (a + b) // 2
    a = a1
    b = b1
    c = c1
    cnt += 1
print(cnt)
# Judge status: Accepted
A,B,C = map(int,input().split())
if C-A+B>0:
    print(C-A+B)
else:
    print(0)
# Judge status: Accepted
S = input()

if S[0] == "R":
    if S[1] =="R":
        if S[2]=="R":
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if S[1] =="R":
        if S[2]=="R":
            print(2)
        else:
            print(1)
    else:
        if S[2]=="R":
            print(1)
        else:
            print(0)
# Judge status: Accepted
X=int(input())
print((X//500)*1000+5*((X%500)//5))
# Judge status: Accepted
def main():
    X, Y = map(int, input().split())
    a = X
    count = 0
    while a <= Y:
        a *= 2
        count += 1
    print(count) 

main()
# Judge status: Wrong Answer
n = int(input())
aas = list(map(int, input().split()))
if n == 1 and aas == [1]:
    print(0)
    exit()
t = 0
for i in aas:
    if i == t + 1:
        t += 1
print(n-t if t > 1 else -1)
# Judge status: Accepted
n = int(input());
s = input();
ans = []

for i in s:
    num = ord(i) + n;
    #正規化
    num = num - ord("A")
    num = num % 26
    ans.append(chr(num  + ord("A")))
    
new = ""
for j in ans:
    new += j

print(new.upper())
# Judge status: Wrong Answer
A = str(input())
AC = list(A)
AB = int(A[0] + A[1])
AC = int(A[2] + A[3])

if 1 <= AB <= 12 and 1 <= AC <= 12:
    print("AMBIGUOUS")
elif AB > 13:
    print("YYMM")
elif AC > 13:
    print("MMYY")
else:
    print("NA")
# Judge status: Accepted
s = list(input())
s.sort()
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
H, W = map(int, input().split(" "))
S = H * W
print(S + S % 2)
# Judge status: Accepted
a, b = map(int, input().split())

if a >= 13:
  print(b)
elif a>=6 and a<=12:
  print(b//2)
else:
  print(0)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()

ans = [False] * N
p = 0
b = 0
for i in range(N):
    if S[i] == 'a':
        if p < A + B:
            ans[i] = True
            p += 1
    elif S[i] == 'b':
        if p < A + B and b < B:
            ans[i] = True
            p += 1
            b += 1

for b in ans:
    print("Yes" if b else "No")
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

before_sum=sum(A)
for i in range(N):
    if A[i]>=B[i]:
        R=A[i]
        A[i]-=B[i]
        B[i]-=R
    elif A[i]+A[i+1]>=B[i]:
        R=A[i]
        A[i]=0
        B[i]-=R
        A[i-1]-=B[i]
    else:
        A[i]=0
        A[i+1]=0

after_sum=sum(A)

print(before_sum-after_sum)
# Judge status: Wrong Answer
N = [int(input()) for _ in range(5)]
A = []
B = []
C = []
for n in N:
    n = list(str(n))
    n.reverse()
    A.append(int(n[0]))
for a in A:
  if a == 0:
    B.append(100)
  else:
    B.append(a)
    C.append(10-a)
print(sum(N)+sum(C)-(10-min(B)))
# Judge status: Accepted
n,k,*h=map(int,open(0).read().split())
if k>=n:
  print(0)
  exit()
h.sort(reverse=True)
for i in range(k):
  h[i]=0
print(sum(h))
# Judge status: Accepted
import math
n = int(input())

while n > 0:
  if math.sqrt(n) % 1 == 0:
    print(n)
    exit()
  n -= 1
# Judge status: Accepted
import sys,math,copy,queue,itertools
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def LI(): return [int(x) for x in input().split()]
N = int(input())
A = LI()

CA = [0 for _ in range(N+1)]
for i in range(N):
    CA[A[i]] += 1

tc = 0
for i in range(1,N+1):
    tc += CA[i] * (CA[i]-1) // 2

for i in range(N):
    ans = tc
    cnt = CA[A[i]]
    if cnt > 1:
        ans -= cnt * (cnt - 1) // 2 - (cnt - 1) * (cnt - 2) // 2
    print (ans)
# Judge status: Wrong Answer
from fractions import gcd
n,m=map(int,input().split())
a=[int(i)//2 for i in input().split()]
def lcm(x,y):
  return x*y//gcd(x,y)
l=a[0]
for i in a:
  l=lcm(l,i)
print((m//l+1)//2)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a >= c:
  a = a-c
else:
  a = 0
  b = b - a- c
print(a,b)
# Judge status: Wrong Answer
s = input()

ans = 1
t = True
b = True
for i in range(1, len(s)):
    if s[i] == s[i - 1] and t:
        if b:
            b = False
            ans += 1
        else: 
            t = False
    elif not t:
        ans += 1
        t = True
    else:
        ans += 1
        b = False

print(ans)
# Judge status: Wrong Answer
N = int(input())
N_List = list(map(int,input().split()))
ct = 0
for i in range(1,N-1):
    print(N_List[i])
    if (N_List[i] > N_List[i-1]) & (N_List[i] < N_List[i+1]):
        ct += 1
    elif (N_List[i] < N_List[i-1]) & (N_List[i] > N_List[i+1]):
        ct += 1


print(ct)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if(n >= m//2):
    print(n)
else:
    m -= 2*n
    print(n + (m//4))
# Judge status: Accepted
import math

ans = 1000000000000000000
N = int(input())
for i in range(math.ceil(math.sqrt(N+1000))):
  if i > 0 and N % i == 0:
    ans = min(i + N/i - 2, ans)
print(int(ans))
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                continue
            if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]:
                count+=1
print(count)
# Judge status: Accepted
def resolve():
    A, B = list(map(int, input().split(" ")))
    S = input()
    print("Yes" if S[A] == "-" and S[:A].isdecimal() and S[A+1:].isdecimal() else "No")


if '__main__' == __name__:
    resolve()
# Judge status: Accepted
a,b = map(int, input().split())
if a<= 8 and b<= 8:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    d, t, s = map(int,input().split())
    if d>s*t:
        print("No")
    else:
        print("Yes")

if __name__=='__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
money = []
for i in range(n):
    if 6**i>n:
        break
    money.append(6**i)
for j in range(1,n):
    if 9**j>n:
        break
    money.append(9**j)
money.sort()
print(money)

ans = {}
for i in range(len(money)):
    if n//money[-(i+1)]>0:
        ans.setdefault(money[-(i+1)],n//money[-(i+1)])
    n = n%money[-(i+1)]

#print(ans)
print(sum(ans.values()))
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))

v.sort()

for i in range(N-1):
    v[i+1] = (v[i]+v[i+1])/2
print(v[N-1])
# Judge status: Wrong Answer
S = input()
f, r = S[:2], S[2:]
if f == "00" or r == "00" or (int(f)>12 and int(r)>12):
  ans = "NA"
elif int(f) > 12 and int(r) <= 12:
  ans = "YYMM"
elif int(r) > 12 and int(f) <= 12:
  ans = "MMYY"
else:
  ans = "AMBIGUOUS"
print(ans)
# Judge status: Wrong Answer
a=int(input())
f=0
for i in range(1,10):
  if a%i==0:
    f=1
if f==1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,m,k=map(int,input().split())
for i in range(n+1):
    for j in range(m+1):
        if k==i*m+j*n-2*i*j:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
n = int(input())
d = sorted(list(map(int,input().split())))
print (d[n//2]-d[(n//2)-1])
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))

ans = 1
tempmin = P[0]
for i in range(1,N):
  if tempmin >= P[i]:
    tempmin = P[i]
    ans += 1

print(ans)
# Judge status: Accepted
W,H,x,y=map(int,input().split())
S=W*H/2
if W/2==x and H/2==y:
    hantei=1
else:
    hantei=0
print(S,hantei)
# Judge status: Wrong Answer
x = int(input())

for i in range(x, 10**5):
    flag = True
    for j in range(2, i):
        if (i % j == 0):
            flag = False
            continue
    if flag:
        print(i)
        break
    else:
        continue
# Judge status: Accepted
A, B = map(int, input().split())
s = B - A
t = 0
for i in range(1,s + 1):
    t += i
ans = t - B
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import Counter


def read():
    S = input().strip()
    return S,


def solve(S):
    D = Counter(S)
    if D["N"] != 0 and D["S"] == 0 or D["N"] == 0 and D["S"] != 0:
        return "No"
    if D["E"] != 0 and D["W"] == 0 or D["E"] == 0 and D["W"] != 0:
        return "No"
    return "Yes"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))
# Judge status: Wrong Answer
input = input()

nums = input.split(" ")

for index, num in enumerate(nums):
    if int(num)==0:
        print(index)
# Judge status: Wrong Answer
a, b = map(int,input().split())
print(a + b)
# Judge status: Accepted
S = input()
num = len(S)

t = 0
for i in range(int(num/2)):
    if S[i] != S[-(i + 1)]:
        t += 1
        
print(t)
# Judge status: Accepted
from collections import deque

s = input()
q = deque()

for si in s:
    if si == "S":
        q.append(si)
    elif si == "T" and len(q) == 0:
        q.append(si)
    elif q[-1] == "T":
        q.append(si)
    elif q[-1] == "S":
        q.pop()
print(len(q))
# Judge status: Accepted
s=input()
ans=999
for i in range(len(s)-2):
    w=int(s[i:i+3])
    ans=min(ans,abs(753-w))
print(ans)
# Judge status: Accepted
import math


a=input()

print("Yes" if a[0]==a[1]==a[2] or a[1]==a[2]==a[3] else "No" )
# Judge status: Accepted
S,T = input().split()
A,B = map(int,input().split())
U = input()
if U == S:
  print(A-1,B)
else:
  print(A,B-1)
# Judge status: Wrong Answer
S = input()
if S[-1]=='s':
  print(S+'s')
else:
  print(S+'es')
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
List=[]
for i in range(K):
  List.append(A+i)
  List.append(B-i)
List.sort()
for i in List:
  print(i)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if i % 2 != 0:
        b.insert(0, a[i])
    else:
        b.append(a[i])

print(' '.join(map(str, b)))
# Judge status: Accepted
from collections import Counter


if __name__ == "__main__":
    C = Counter()
    N = int(input())
    for c in [chr(n) for n in range(ord("a"), ord("z")+1)]:
        C[c] = 10**8
    for _ in range(N):
        cs = Counter(input())
        C &= cs
    for k, v in C.items():
        print(k*v, end="")
    print()
# Judge status: Accepted
N=int(input())
H=list(map(int,input().split()))

for i in range(N):
    if i==0:
        continue
    if  H[i]<H[i-1]:
        print("No")
        exit()
    if H[i-1]<H[i]:
        H[i]-=1

print("Yes")
# Judge status: Accepted
S = input()
T = input()
def match(s,t):
    for c,d in zip(s,t):
        if c == "?":
            continue
        elif c == d:
            continue
        else:
            return False
    return True
for i in range(len(S)-len(T), -1, -1):
    s = S[i:i+len(T)]
    if match(s, T):
        print((S[:i]+T+S[i+len(T):]).replace("?","a"))
        exit(0)
print("UNRESTORABLE")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i+1]<p[i] and p[i]<p[i-1]):
        cnt += 1

print(cnt)
# Judge status: Accepted
import itertools
n = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
p_list = list(itertools.permutations(P, n))
p_list = sorted(p_list)

for i in range(len(p_list)):
    if p_list[i] == tuple(P):
        pnum = i

    if p_list[i] == tuple(Q):
        qnum = i

print(abs(pnum-qnum))
# Judge status: Accepted
a=list(map(int,input().split()))
a.sort()
cnt=0
if a[1]!=a[2]:
    cnt=a[2]-a[1]
    a[0]+=cnt
    a[1]+=cnt
if 1==(a[1]-a[0])%2:
    a[1]+=1
    a[2]+=1
    cnt+=1
if a[0]!=a[1]:
    n=int((a[1]-a[0])/2)
    cnt+=n
    #a[0]+=(n*2)
print(cnt)
# Judge status: Accepted
n, q = map(int, input().split())
s = list(str(input()))


t = [0] * (n+1)
for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]


t[-1] = t[-2]


for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
# Judge status: Accepted
def main2():
    x, y = map(int, input().split())
    
    ans = 10**10
    if x <= y:
        ans = min(ans, y - x)
    if -x <= y:
        ans = min(ans, y - (-x) + 1 )
    if x <= -y:
        ans = min(ans, -y - x + 1)
    if -x <= -y:
        ans = min(ans, -y - (-x) + 2)

    print(ans)

if __name__ == "__main__":
    main2()
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

pa=a%2
pb=b%2
pc=c%2

cnt = 0

if not(pa==pb and pb==pc):
    cnt = 1
    
ans = cnt + (3*max(max(a,b),c)-(a+b+c))/2
print(int(ans))
# Judge status: Accepted
num = list(map(str,input()))
if num[0]== 'R' and num[1] =='S':
    print('1')
else:
    print(num.count('R'))
# Judge status: Wrong Answer
def calc(n):
    if n == 1:
        return 1
    elif n == 0:
        return 2
    if res[n] != 0:
        return res[n]
    tmp = calc(n-1) + calc(n-2)
    res[n] = tmp
    return tmp

N = int(input())
res = [0] * 100
calc(N)
print(res[N])
# Judge status: Accepted
from collections import Counter
n = int(input())
S = input()
alr = set(S)
temp = Counter(S)
for _ in range(n-1):
    S = Counter(input())
    alr &= set(S)
    for k, v in S.items():
        if k in alr:
            temp[k] = min(temp[k], v)
ans = []
for k in list(alr):
    for _ in range(temp[k]):
        ans.append(k)
ans.sort()
print("".join(ans))
# Judge status: Accepted
S = input()
c0 = S.count('0')
c1 = S.count('1')
print(min(c0,c1)*2)
# Judge status: Accepted
[n, m] = [int(s) for s in input().split()]
h = [int(s) for s in input().split()]
r = [[] for _ in range(n)]

for _ in range(m):
    [a, b] = [int(s)-1 for s in input().split()]
    r[a].append(b)
    r[b].append(a)

print(len([0 for i, hi in enumerate(h) if len([0 for j in r[i] if h[j] >= hi]) == 0]))
# Judge status: Accepted
N,K = list(map(int,input().split()))
pi = list(map(int,input().split()))
value = sum(pi[:K])
max_value = value
for i in range(N-K):
  value += pi[i+K] - pi[i]
  max_value = max(value, max_value)
print((max_value+K)/2)
# Judge status: Wrong Answer
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if A == B:
  print("YES")
  exit()

if W > V:
  print("NO")
  exit()
  
if A > B:
  V *= -1
  W *= -1
    
  for t in range(T):
    A += V
    B += W
    print(t,A,B)
    if A <= B:
      print("YES")
      exit()
  
else:
  for t in range(T):
    A += V
    B += W
    if A >= B:
      print("YES")
      exit()
    
print("NO")
# Judge status: Accepted
from collections import deque
o = deque(list(input()))
e = deque(list(input()))
pas = []
while (o or e):
    if o:
        pas.append(o.popleft())
    if e:
        pas.append(e.popleft())
    
print(*pas, sep="")
# Judge status: Accepted
def c(n):
    if n == 1:
        return n
    elif n == 2:
        return 0
    else:
        return n-2

N,M = map(int,input().split())
print(c(N)*c(M))
# Judge status: Wrong Answer
n = int(input())
 
lis = []
 
for i in range(n):
  lis.append(list(map(int,input().split())))
 
las=-1
first = 0
 
for val in range(n):
  if las >= 0:
    lis[val][las] = 0
  a = lis[val].index(max(lis[val]))
  if a >= 0:
    las = a
    first += (lis[val][a])
 
print(first)
# Judge status: Wrong Answer
N, M = map(int, input().split())

l = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0

for a, b in sorted(l, key=lambda x:(-x[1],-x[0])):
    if M<1:break
    if a<=M:
        ans += b
        M -= 1

print(ans)
# Judge status: Wrong Answer
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
import numpy as np
#======================================================#
MOD=10**9+7
def main():
    n = II()
    aa = np.array(MII())
    ans = 0
    for i in range(60):
        cnt1 = (aa&1).sum()
        ans += cnt1*(n-cnt1)*(2**i)
        aa >>= 1
    print(ans%MOD)

if __name__ == '__main__':
    main()