#!/usr/bin/env python

def main():
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7

    bin_list = [[0, 0] for _ in range(60)]

    for j in range(60):
        for i in range(n):
            a[i], b = divmod(a[i], 2)
            bin_list[j][b] += 1

    sum_ = 0
    for j in range(60):
        sum_ += bin_list[j][0] * bin_list[j][1] * (2 ** j) % mod
        sum_ %= mod

    print(sum_)


if __name__ == '__main__':
    main()
