def getN():

    return int(eval(input()))





def getNM():

    return list(map(int, input().split()))





def getList():

    return list(map(int, input().split()))





from collections import defaultdict, deque

from sys import exit

import math

import copy

from bisect import bisect_left, bisect_right

from heapq import *

import sys



# sys.setrecursionlimit(1000000)

INF = 10 ** 17

MOD = 1000000007



from fractions import *





def inverse(f):

    # return Fraction(f.denominator,f.numerator)

    return 1 / f





def combmod(n, k, mod=MOD):

    ret = 1

    for i in range(n - k + 1, n + 1):

        ret *= i

        ret %= mod



    for i in range(1, k + 1):

        ret *= pow(i, mod - 2, mod)

        ret %= mod



    return ret



MOD = 10 ** 9 + 7

def solve():

    n = getN()

    bit_array = [[0, 0] for i in range(61)]

    nums = getList()

    for num in nums:

        digit = 0

        while(digit < 61):

            if num % 2 == 0:

                bit_array[digit][0] += 1

            else:

                bit_array[digit][1] += 1

            digit += 1

            num //= 2





    # print(bit_array)

    ans = 0

    for i, tgt in enumerate(bit_array):

        ans += pow(2, i, MOD) * tgt[0] * tgt[1]

        ans %= MOD



    print(ans   )



def main():

    n = getN()

    for _ in range(n):

        solve()





if __name__ == "__main__":

    solve()
import sys

from collections import defaultdict, deque, Counter

import math



# import copy

from bisect import bisect_left, bisect_right

import heapq



# sys.setrecursionlimit(1000000)



# input aliases

input = sys.stdin.readline



getS = lambda: input().strip()

getN = lambda: int(eval(input()))

getList = lambda: list(map(int, input().split()))

getZList = lambda: [int(x) - 1 for x in input().split()]



INF = 10 ** 20

MOD = 10**9 + 7

divide = lambda x: pow(x, MOD-2, MOD)





def nck(n, k, kaijyo):

    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD





def npk(n, k, kaijyo):

    if k == 0 or k == n:

        return n % MOD

    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD





def kaijyo(n):

    ret = [1]

    for i in range(1, n + 1):

        ret.append((ret[-1] * i)% MOD)

    return ret



def solve():



    n = getN()

    nums = getList()

    keta = [[0, 0] for i in range(62)]



    for num in nums:

        tmp = num

        for i in range(62):

            if tmp % 2 == 1:

                keta[i][1] += 1

            else:

                keta[i][0] += 1



            tmp //= 2



    ans = 0

    dig = 0

    for k1, k2 in keta:

        ans += ((k1 * k2) * (2**dig)) % MOD

        dig += 1



    print((ans % MOD))





def main():

    n = getN()

    for _ in range(n):

        solve()





if __name__ == "__main__":

    # main()

    solve()
def getN():
    return int(eval(input()))


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


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


from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
from heapq import *
import sys

# sys.setrecursionlimit(1000000)
INF = 10**17
MOD = 1000000007
from fractions import *


def inverse(f):
    # return Fraction(f.denominator,f.numerator)
    return 1 / f


def combmod(n, k, mod=MOD):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod
    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod
    return ret


MOD = 10**9 + 7


def solve():
    n = getN()
    bit_array = [[0, 0] for i in range(61)]
    nums = getList()
    for num in nums:
        digit = 0
        while digit < 61:
            if num % 2 == 0:
                bit_array[digit][0] += 1
            else:
                bit_array[digit][1] += 1
            digit += 1
            num //= 2
    # print(bit_array)
    ans = 0
    for i, tgt in enumerate(bit_array):
        ans += pow(2, i, MOD) * tgt[0] * tgt[1]
        ans %= MOD
    print(ans)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    solve()

import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
INF = 10**20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i) % MOD)
    return ret


def solve():
    n = getN()
    nums = getList()
    keta = [[0, 0] for i in range(62)]
    for num in nums:
        tmp = num
        for i in range(62):
            if tmp % 2 == 1:
                keta[i][1] += 1
            else:
                keta[i][0] += 1
            tmp //= 2
    ans = 0
    dig = 0
    for k1, k2 in keta:
        ans += ((k1 * k2) * (2**dig)) % MOD
        dig += 1
    print((ans % MOD))


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

-def getN(): -    return int(eval(input())) +import sys +from collections import defaultdict, deque, Counter +import math + +# import copy +from bisect import bisect_left, bisect_right +import heapq + +# sys.setrecursionlimit(1000000) +# input aliases +input = sys.stdin.readline +getS = lambda: input().strip() +getN = lambda: int(eval(input())) +getList = lambda: list(map(int, input().split())) +getZList = lambda: [int(x) - 1 for x in input().split()] +INF = 10**20 +MOD = 10**9 + 7 +divide = lambda x: pow(x, MOD - 2, MOD) -def getNM(): -    return list(map(int, input().split())) +def nck(n, k, kaijyo): +    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD -def getList(): -    return list(map(int, input().split())) +def npk(n, k, kaijyo): +    if k == 0 or k == n: +        return n % MOD +    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD -from collections import defaultdict, deque -from sys import exit -import math -import copy -from bisect import bisect_left, bisect_right -from heapq import * -import sys - -# sys.setrecursionlimit(1000000) -INF = 10**17 -MOD = 1000000007 -from fractions import * - - -def inverse(f): -    # return Fraction(f.denominator,f.numerator) -    return 1 / f - - -def combmod(n, k, mod=MOD): -    ret = 1 -    for i in range(n - k + 1, n + 1): -        ret *= i -        ret %= mod -    for i in range(1, k + 1): -        ret *= pow(i, mod - 2, mod) -        ret %= mod +def kaijyo(n): +    ret = [1] +    for i in range(1, n + 1): +        ret.append((ret[-1] * i) % MOD) - - -MOD = 10**9 + 7 -    bit_array = [[0, 0] for i in range(61)] +    keta = [[0, 0] for i in range(62)] -        digit = 0 -        while digit < 61: -            if num % 2 == 0: -                bit_array[digit][0] += 1 +        tmp = num +        for i in range(62): +            if tmp % 2 == 1: +                keta[i][1] += 1 -                bit_array[digit][1] += 1 -            digit += 1 -            num //= 2 -    # print(bit_array) +                keta[i][0] += 1 +            tmp //= 2 -    for i, tgt in enumerate(bit_array): -        ans += pow(2, i, MOD) * tgt[0] * tgt[1] -        ans %= MOD -    print(ans) +    dig = 0 +    for k1, k2 in keta: +        ans += ((k1 * k2) * (2**dig)) % MOD +        dig += 1 +    print((ans % MOD)) +    # main()