import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


class Solver(object):
    def __init__(self):
        pass

    def solve(self, n, arr):
        sum = 0
        for i in range(128):
            zc = 0
            oc = 0
            idsum = 0
            for j in range(0, n):
                if (arr[j] % 2 == 0):
                    zc = zc + 1
                else:
                    oc = oc + 1
                arr[j] = int(arr[j] / 2)
            idsum = oc * zc * (1 << i)
            sum = sum + idsum
        return sum % (10**9 + 7)


def main():
    N = int(input())
    A_l = [int(i) for i in input().split()]
    solver = Solver()
    print(solver.solve(N, A_l))


if __name__ == "__main__":
    main()