import sys

# import re
# import math
# import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
# import copy
# import heapq
# import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    lim = 60
    zero = [0 for _ in range(lim)]
    one = [0 for _ in range(lim)]

    for ai in a:
        for i in range(lim):
            if ai >> i & 1:
                one[i] += 1
            else:
                zero[i] += 1

    ans = 0
    for i in range(lim):
        ans += 2 ** i * zero[i] * one[i]
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()
