import sys
input = sys.stdin.readline

def main():
    N = map(int,input().split())
    a = list(map(int,input().split()))
    MOD = 10**9+7
    M = max(a)
    l = M.bit_length()
    bit = [[0,0] for _ in range(l)]

    for num in a:
        for i in range(l):
            re = num%2
            bit[i][re] += 1
            num //= 2

    ans = 0
    for i in range(l):
        x = (bit[i][0]*bit[i][1])*(1<<i)
        ans += (x%MOD)
    
    print(ans%MOD)    
    
if __name__ == "__main__":
    main()
