from sys import stdin
def main():
    n = int(stdin.readline().rstrip())
    a = list(map(int,stdin.readline().rstrip().split()))
    mod = 10**9+7
    point = 0
    kai = [2**i%mod for i in range(61)]
    for i in range(61):
        now = sum(1 for j in a if(j >> i)&1)
        now *= n-now
        now *= kai[i]
        point += now
    print(point%mod)
if __name__ == "__main__":
    main()