MOD = int(1e9+7)


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


def main():
    N = int(input())
    A = list(map(int, input().split()))
    M = 60
    bitcnt = [0] * M
    for a in A:
        for i in range(M):
            if a & (1 << i):
                bitcnt[i] += 1
    ans = 0
    for a in A:
        for i in range(M):
            if a & (1 << i):
                ans += (1 << i) * (N - bitcnt[i])
            else:
                ans += (1 << i) * bitcnt[i]
            ans %= MOD
    ans = div(ans, 2)
    print(ans)


if __name__ == "__main__":
    main()
