if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    mod = 1000000007

    for i in range(60):
        x = 0
        for j in range(n):
            if a[j] >> i & 1:
                x += 1
        
        now = x * (n - x) % mod
        for j in range(i):
            now = now * 2 % mod
        ans += now
        ans %= mod
    print(ans)