Harryxun/stf_run huggingface dataset:
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]

check = []
for i in range(n-1):
    for j in range(i+1,n):
        check.append([xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]])

ans = 10**9
for i in check:
    b = []
    for j in range(n):
        b.append([xy[j][0]-i[0],xy[j][1]-i[1]])
    c = n
    for j in range(n):
        if b[j] in xy:
            c -= 1
    if c < ans:
        ans = c
print(c)

### FIXED CODE ###

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

check = []
for i in range(n-1):
    for j in range(i+1,n):
        check.append([xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]])
#print(check)
ans = 10**9
for i in check:
    b = []
    for j in range(n):
        b.append([xy[j][0]-i[0],xy[j][1]-i[1]])
    c = n
    for j in range(n):
        if b[j] in xy:
            c -= 1
    if c < ans:
        ans = c
if n == 1:
    print(1)
else:
    print(ans)
import itertools


N, M = map(int, input().split())
graph = [[False]*N for _ in range(M)]

for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a][b] = True
    graph[b][a] = True

ans = 0
for x in itertools.permutations(range(1, N)):
    # このxの順番で訪問できるか確かめる
    flag = True
    now = 0
    for e in x:
        if not graph[now][e]:
            flag = False
        now = e
    if flag:
        ans += 1
print(ans)


### FIXED CODE ###

def dfs(visited, s):  #
    global ans
    visited[s] = True
    for t in graph[s]:
        if not visited[t]:
            dfs(visited[:], t)
    if all(visited):
        ans += 1


N, M = map(int, input().split())  # N頂点, M辺存在する

graph = [[] for _ in range(N)]
visited = [False] * N

for _ in range(M):  # M辺を受け取る
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)


ans = 0
dfs(visited, 0)

print(ans)
class Solution:
    def solve(self, H: int, W: int) -> int:

        if H == 1 or W == 1:
            return 1
        else:
            return (H*W + 1) // 2


if __name__ == '__main__':

    # standard input
    H, W = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(H, W))


### FIXED CODE ###


class Solution:

    def solve(self, N: int):

        def dfs(prev_str, num_used_char):
            if len(prev_str) == N:
                print(prev_str)
                return

            for i in range(num_used_char):
                c = chr(ord('a') + i)
                dfs(prev_str + c, num_used_char)

            c = chr(ord('a') + num_used_char)
            dfs(prev_str + c, num_used_char + 1)

        dfs('a', 1)


if __name__ == '__main__':

    # standard input
    N = int(input())
    # solve
    solution = Solution()
    answer = solution.solve(N)
input_line=input().rstrip().split(" ")
five=int(input_line.count("5"))
seven=int(input_line.count("7"))
if five=2 and seven=1:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

input_line=input().rstrip().split(" ")
five=int(input_line.count("5"))
seven=int(input_line.count("7"))
if five==2 and seven==1:
    print("YES")
else:
    print("NO")
#handshake
from scipy.fft import rfft, irfft
import numpy as np
N, M = map(int, input().split())
A = np.array(input().split(), dtype=np.int32)

x = np.bincount(A)
fft_size = 1 << (2 * x.size + 10).bit_length()

fx = rfft(x, fft_size)
conv = irfft(fx * fx, fft_size)
conv = (conv + 0.5).astype(int)

tmp = np.arange(conv.size, dtype=int)
happy = tmp[np.nonzero(conv)].tolist()
cnt = conv[np.nonzero(conv)].tolist()


ans = 0
while M > 0:
    h = happy.pop()
    num = cnt.pop()
    num = min(M, num)

M -= num
ans += num * h

print(ans)


### FIXED CODE ###

import bisect

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = [0] * N
B[-1] = A[-1]
for i in range(N - 2, -1, -1):
    B[i] = B[i+1]+A[i]


def C(mid):
    tmp = 0
    for a in A:
        pos = bisect.bisect_right(A, mid - a)
        tmp += N-pos
    return tmp > M


lb = 0
rb = 10**6
while rb - lb > 1:
    happy = (lb + rb) // 2
    if C(happy):
        lb = happy
    else:
        rb = happy

ans = 0
cnt = 0
for a in A:
    pos = bisect.bisect_right(A, rb - a)
    if pos == N:
        continue
    ans += B[pos]+(N-pos)*a
    cnt += N - pos
ans += (M-cnt)*rb
print(ans)
input_str = raw_input()

translate_num = (int("input_str"))**

print("translate_num\n")

### FIXED CODE ###

input_str = input()

translate_num = (int(input_str))**3

print(translate_num)
N = input()
N = int(N)

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N-1:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])

print(score)


### FIXED CODE ###

N = input()
N = int(N)
print(N**3)
import sys
input = sys.stdin.readline

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

need =[2,5,5,4,5,6,3,7,6]

if 2 in A and 3 in A:
  del A[A.index(2)]
if 3 in A and 5 in A:
  del A[A.index(3)]
if 6 in A and 9 in A:
  del A[A.index(6)]
if 1 in A and 4 in A:
  del A[A.index(4)]
if 6 in A and 7 in A:
  del A[A.index(6)] 
if 7 in A and 9 in A:
  del A[A.index(9)] 
if 1 in A and 6 in A:
  del A[A.index(6)] 
if 1 in A and 9 in A:
  del A[A.index(9)] 
  
M = len(A)

dp = [[0]*(N+1) for _ in range(M)]
dpmax = [0]*(N+1)

for j in range(2,N+1):
  tmpmax = 0
  for i in range(M):
    tmp = need[A[i]-1]
    if j == tmp:
      res = A[i]
    elif j > tmp:
      if dpmax[j-tmp] != 0:
        tmp2 = dpmax[j-tmp]
        res = max(A[i]*(10**len(str(tmp2)) + tmp2,tmp2*10+A[i]))
    if tmpmax < res:
      tmpmax = res
    dp[i][j] = res
  dpmax[j] = tmpmax
  
print(dpmax[-1])

### FIXED CODE ###

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

if N % 2 == 0:
  if 1 in A:
    print(int('1'*(N//2)))
    exit()

need =(2,5,5,4,5,6,3,7,6)

if 2 in A and 3 in A:
  del A[A.index(2)]
if 3 in A and 5 in A:
  del A[A.index(3)]
if 6 in A and 9 in A:
  del A[A.index(6)]
if 1 in A and 4 in A:
  del A[A.index(4)]
if 6 in A and 7 in A:
  del A[A.index(6)] 
if 7 in A and 9 in A:
  del A[A.index(9)] 
if 1 in A and 6 in A:
  del A[A.index(6)] 
if 1 in A and 9 in A:
  del A[A.index(9)] 
  
A = tuple(A)
M = len(A)

dp = [[0]*(N+1) for _ in range(M)]
dpmax = [0]*(N+1)

def take_max():
  return max(A[i]*(10**len(str(tmp2)) + tmp2,tmp2*10+A[i]))

for j in range(2,N+1):
  tmpmax = 0
  for i in range(M):
    tmp = need[A[i]-1]
    if j == tmp:
      dp[i][j] = A[i]
    elif j > tmp:
      if dpmax[j-tmp] != 0:
        tmp2 = dpmax[j-tmp]
        dp[i][j] = take_max()
    if tmpmax < dp[i][j]:
      tmpmax = dp[i][j]
  dpmax[j] = tmpmax
  
print(dpmax[-1])
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=1000000
ans=-1
for i in range(n):
    ave=t-(h[i]*0.006)
    tmp=a-ave
    if tmp < 0:
        tmp*=-1
    if diff > tmp:
        diff=tmp
        ans=i+1
print(ans)p

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=1000000
for i in range(n):
    ave=t-(h[i]*0.006)
    tmp=a-ave
    if tmp < 0:
        tmp*=-1
    if diff > tmp:
        diff=tmp
        ans=i+1
print(ans)
K = int(input())
S = int(input())
if K > len(S):
    print(S)
else:
    print(S[0:K] + '...')

### FIXED CODE ###

K = int(input())
S = str(input())
if K >= len(S):
    print(S)
else:
    print(S[0:K] + '...')
N , K = map(int , input().split())
R , S , P = map(int , input().split())
T = input()

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

VANISH = []
    
for i in range(N-K):
    if ans[i] == ans[i+K]:
        VANISH.append(ans[i])

print(VANISH)
        
if N - (2*K) > 0:
    for i in range(N - (2*K)):
        if ans[i] == ans[i+(2*K)]:
            VANISH.remove(ans[i])
            
print(VANISH)
            
vanish = "".join(VANISH)
        
point = ((ans.count("r")-vanish.count("r"))*R + (ans.count("s")-vanish.count("s"))*S + (ans.count("p")-vanish.count("p"))*P)

print(point)

### FIXED CODE ###

N , K = map(int , input().split())
R , S , P = map(int , input().split())
T = input()

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

for i in range(K , N):
    if ans[i] == ans[i-K]:
        ans = ans[:i] + "X" + ans[i+1:]
        
point = ans.count("r")*R + ans.count("s")*S + ans.count("p")*P

print(point)
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort() or  len(s) % 2 != 0]))

### FIXED CODE ###

from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][Counter(s) == Counter(t)])
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:a-x,field))

ans = diff[0]

for i in diff[1:]:
    ans = math.gcd(ans,i)

print(ans)

### FIXED CODE ###

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

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):
    # print(x,y)
    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        return gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)
def resolve():
    a, b, h = map(int, input().split())
    print((a + b) * h // 2)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    a = int(input())
    b = int(input())
    h = int(input())
    print((a + b) * h // 2)


if __name__ == "__main__":
    resolve()
def c_kth_substring(S, K):
    tmp = []
    for i in range(len(S)):
        for j in range(i + 1, len(S) + 1):
            tmp.append(S[i:j])
    tmp = sorted(set(tmp))
    ans = tmp[K - 1]
    return ans

S = input().strip()
K = int(input())
print(c_kth_substring(S, K))

### FIXED CODE ###

def c_kth_substring(S, K):
    tmp = []
    for i in range(len(S)):
        for j in range(i + 1, i + K + 1):
            if j <= len(S)+1:
                tmp.append(S[i:j])
    tmp = sorted(set(tmp))
    ans = tmp[K - 1]
    return ans

S = input().strip()
K = int(input())
print(c_kth_substring(S, K))
N, M = (int(i) for i in input().split())
DP[N] = [False]*N
for i in range(M):
  a, b = (int(i) for i in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print(NO)
    break
else:
  print(YES)

### FIXED CODE ###

N, M = (int(i) for i in input().split())
DP = [False]*N
for i in range(M):
  a, b = (int(k) for k in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print('NO')
    break
else:
  print('YES')
s = input()
q = int(input())

from collections import deque

ss = deque(s)
flg = True

for i in range(q):
  t = input().split()
  if t[0] == '1':
    flg = not flg
  else:
    if t[1] == '2':
        ss.append(t[2]) if flg else ss.appendleft(t[2])
    else:
        ss.append(t[2]) if not flg else ss.appendleft(t[2])



print("".join(ss)) if flg else print("".join(ss[::-1]))



### FIXED CODE ###

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

from collections import deque

ss = deque(s)
flg = True

for i in range(q):
  t = input().split()
  if t[0] == '1':
    flg = not flg
  else:
    if t[1] == '2':
        ss.append(t[2]) if flg else ss.appendleft(t[2])
    else:
        ss.append(t[2]) if not flg else ss.appendleft(t[2])

ss = list(ss)

print("".join(ss)) if flg else print("".join(ss[::-1]))
from sys import stdin
import sys

T = input()
t = T[0]
ans = []
if t == '?' and T[1] == 'D':
    ans.append('P')
elif t == '?' and T[1] == 'P':
    ans.append('D')
else:
    ans.append(t)

for i in range(1, len(T)):
    if t == 'P':
        if T[i] == '?':
            ans.append('D')
            t = 'D'
        else:
            ans.append(T[i])
            t = T[i]
    elif t == 'D' and i < len(T)-1 and T[i+1] == '?':
        if T[i] == '?':
            ans.append('P')
            t = 'P'
        else:
            ans.append(T[i])
            t = T[i]
    elif t == 'D' and i < len(T)-1 and T[i+1] == 'D':
        if T[i] == '?':
            ans.append('P')
            t = 'P'
        else:
            ans.append(T[i])
            t = T[i]
    else:
        if T[i] == '?':
            ans.append('D')
            t = 'D'
        else:
            ans.append(T[i])
            t = T[i]
print(''.join(ans))

### FIXED CODE ###

from sys import stdin
import sys

T = input()
if T == '?':
    print('D')
    sys.exit()
if T[0] == '?' and T[1] == '?':
    T = 'P'+T[1:]
    # print(T)
t = T[0]
ans = []
if t == '?' and T[1] == 'D':
    ans.append('P')
elif t == '?' and T[1] == 'P':
    ans.append('D')
else:
    ans.append(t)

for i in range(1, len(T)):
    if t == 'P':
        if T[i] == '?':
            ans.append('D')
            t = 'D'
        else:
            ans.append(T[i])
            t = T[i]
    elif t == 'D' and i < len(T)-1 and T[i+1] == '?':
        if T[i] == '?':
            ans.append('P')
            t = 'P'
        else:
            ans.append(T[i])
            t = T[i]
    elif t == 'D' and i < len(T)-1 and T[i+1] == 'D':
        if T[i] == '?':
            ans.append('P')
            t = 'P'
        else:
            ans.append(T[i])
            t = T[i]
    else:
        if T[i] == '?':
            ans.append('D')
            t = 'D'
        else:
            ans.append(T[i])
            t = T[i]
print(''.join(ans))
N, M = (int(i) for i in input().split())
DP[N] = [False]*N
for i in range(M):
  a, b = (int(i) for i in input().split())
  for i in (a, b):
    DP[i] = not DP[i]
for i in range(N):
  if DP[i]:
    print(NO)
    break
else:
  print(YES)

### FIXED CODE ###

N, M = (int(i) for i in input().split())
DP = [False]*N
for i in range(M):
  a, b = (int(k) for k in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print('NO')
    break
else:
  print('YES')
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

i = 0
j = 0
k = 0


def judge(sum, xxx):
    sum = 500 * i + 100 * j + 50 * k
    return sum == xxx and sum <= 2000


count = 0
for i in range(x500):
    if judge(i, j, k):
        count += 1
    for j in range(x100):
        if judge(i, j, k):
            count += 1
        for k in range(x50):
            if judge(i, j, k):
                count += 1
print(count)


### FIXED CODE ###

A, B, C, x = [int(input()) for i in range(4)]
print(sum(500 * a + 100 * b + 50 * c == x for a in range(A+1) for b in range(B+1) for c in range(C+1)))
import  math
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = []


for i in range(n):
  nums.append(getN())

half = int(math.floor(n/2))
nums.sort()
nums1 = nums[:half]
nums2 = nums[half:]
nums2[1], nums2[-1] = nums2[-1], nums2[1]

tmp = nums2[0]
diff = 0
diff2 = 0
for i in range(half):
    num = nums2[i]
    diff += abs(tmp-num)
    tmp = num

    num = nums1[i]
    diff += abs(tmp - num)
    tmp = num

if n%2 == 1:
    diff += abs(tmp-nums2[-1])

if n%2 == 1:
    nums1 = nums[:half+1]
    nums2 = nums[half+1:]
    nums1[0], nums1[-2] = nums1[-2], nums1[0]

    tmp = nums1[0]
    for i in range(half):
        num = nums1[i]
        diff2 += abs(tmp - num)
        tmp = num

        num = nums2[i]
        diff2 += abs(tmp - num)
        tmp = num

    diff2 += abs(tmp-nums1[-1])

#print(nums1)
#print(nums2)
print(max(diff, diff2))
"""
3 4 5 9
1 1 3
"""


### FIXED CODE ###

import  math
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = []


for i in range(n):
  nums.append(getN())

if n == 2:
    print(abs(nums[0]-nums[1]))

if n > 2:
    half = int(math.floor(n/2))
    nums.sort()
    nums1 = nums[:half]
    nums2 = nums[half:]
    nums2[1], nums2[-1] = nums2[-1], nums2[1]

    tmp = nums2[0]
    diff = 0
    diff2 = 0
    for i in range(half):
        num = nums2[i]
        diff += abs(tmp-num)
        tmp = num

        num = nums1[i]
        diff += abs(tmp - num)
        tmp = num

    if n%2 == 1:
        diff += abs(tmp-nums2[-1])

    if n%2 == 1:
        nums1 = nums[:half+1]
        nums2 = nums[half+1:]
        nums1[0], nums1[-2] = nums1[-2], nums1[0]

        tmp = nums1[0]
        for i in range(half):
            num = nums1[i]
            diff2 += abs(tmp - num)
            tmp = num

            num = nums2[i]
            diff2 += abs(tmp - num)
            tmp = num

        diff2 += abs(tmp-nums1[-1])

    #print(nums1)
    #print(nums2)
    print(max(diff, diff2))
"""
3 4 5 9
1 1 3
"""
class Combination:
    """
  O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
  n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
  使用例：
  comb = Combination(1000000)
  print(comb(5, 3))  # 10
  """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]

        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * \
                modinv[self.mod % i] % self.mod
        return modinv


MOD = 10**9 + 7

r1, c1, r2, c2 = map(int, input().split())
c = Combination(100000)
ans = 0
for r in range(r1, r2 + 1):
    temp = c(c2 + r + 1, r + 1) - c(c1 + r + 1 - 1, r + 1)
    temp %= MOD
    ans += temp
    ans %= MOD
print(ans)


### FIXED CODE ###

class Combination:
    """
  O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
  n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
  使用例：
  comb = Combination(1000000)
  print(comb(5, 3))  # 10
  """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]

        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * \
                modinv[self.mod % i] % self.mod
        return modinv


MOD = 10**9 + 7

r1, c1, r2, c2 = map(int, input().split())
c = Combination(2000006)
ans = 0
for r in range(r1, r2 + 1):
    temp = c(c2 + r + 1, r + 1) - c(c1 + r + 1 - 1, r + 1)
    temp %= MOD
    ans += temp
    ans %= MOD
print(ans)
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
if s <= k: print(comb(s+2, 2))
elif s <= 2*k: print(3*comb(s-k+2, 2))
else: print(3*comb(s-2k+2,2))

### FIXED CODE ###

ans = 0
k, s = map(int, input().split())
for x in range(k+1):
  for y in range(k+1):
    z = s - x - y
    if 0 <= z and z <= k:
      ans += 1
 
 
 
print(ans)
a,b = map(int,input().split)
h,w = map(int,input().split)
print((a-h)*(b-w))


### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())
print((H-h)*(W-w))
import sys

def check_ans(s,x):
  if len(s)==0 and x!=0:
    return False
  elif len(s)==0 and x==0:
    return True
  a=len(s)+1
  dp=[[False for i in range(8001)] for j in range(len(s)+1)]
  dp[1][s[0]]=True
  for i in range(1,len(s)):
    for j in range(0,8002):
      if dp[i][j]:
        res=abs(j+s[i])
        res2=abs(j-s[i])
        dp[i+1][res]=True
        dp[i+1][res2]=True
  return dp[len(s)][x]

S = sys.stdin.readline().strip()
X,Y=map(int,input().split())
d=1
while S and S[0]=='F':
  S=S[1:]
  X-=1
if len(S)==0:
  if X==0:
    print("Yes")
  else:
    print("No")
  sys.exit()

nx=[]
ny=[]
X=abs(X)
Y=abs(Y)

while S:
  step=0
  while S and S[0]=='T':
    d*=-1
    S=S[1:]
  while S and S[0]=='F':
    step+=1
    S=S[1:]
  if step==0:
    break
  if d==1:
    nx.append(step)
  else:
    ny.append(step)

if check_ans(nx,X) and check_ans(ny,Y):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys

def check_ans(s,x):
  res=[0]
  for i in s:
    res = set([x + i for x in res]) | set([x - i for x in res])
  return x in res

S = sys.stdin.readline().strip()
X,Y=map(int,input().split())
d=1
while S and S[0]=='F':
  S=S[1:]
  X-=1
if len(S)==0:
  if X==0 and Y==0:
    print("Yes")
  else:
    print("No")
  sys.exit()

nx=[]
ny=[]
X=abs(X)
Y=abs(Y)

while S:
  step=0
  while S and S[0]=='T':
    d*=-1
    S=S[1:]
  while S and S[0]=='F':
    step+=1
    S=S[1:]
  if step==0:
    break
  if d==1:
    nx.append(step)
  else:
    ny.append(step)

if check_ans(nx,X) and check_ans(ny,Y):
  print("Yes")
else:
  print("No")
N, M = map(int,input().split())

ls = []

L, R = map(int,input().split())
l = [k+L for k in range(R-L+1)]

cs = []

if M == 1:
    print(len(l))
else:
    for i in range(M-1):
        L, R = map(int,input().split())
        if L in l:
            c = l[-1] - L + 1
            cs.append(c)

    print(min(cs))

### FIXED CODE ###

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

Ls, Rs = [0 for _ in range(M)],  [0 for _ in range(M)]

for i in range(M):
    L, R = map(int,input().split())
    Ls[i] = L
    Rs[i] = R
    
L_prime = max(Ls)
R_peime = min(Rs)

if L_prime > R_peime:
    print(0)
else:
    print(R_peime - L_prime + 1)
import math
# import sys
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines

def myinput():
    return map(int,input().split())

n = int(input())
a = list(myinput())
mod = 10**9 + 7
ans = 0

m = math.floor(math.log(max(a),2))+1

if max(a)==0:
  print(0)
  exit()

for j in range(m):
    one = 0
    zero = 0
    for i in range(n):
        b = str(bin(a[i]))[2:]
        c = b.zfill(m)
        s = int(c[m-j-1])
        if s==0:
            zero += 1
        else:
            one += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod
print(ans%mod)

### FIXED CODE ###

import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def myinput():
    return map(int,readline().split())

n = int(readline())
a = list(myinput())
mod = 10**9 + 7
ans = 0

for j in range(60):
    k = 2**j
    one = 0
    zero = 0
    for i in range(n):
        if (a[i]&k):
            one += 1
        else:
            zero += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod   

print(ans%mod)