if __name__ == '__main__':
    MOD = 10 ** 9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    res = 0
    two_factor = 1

    for d in range(60):
        even, odd = 0, 0
        for i in range(n):
            if a[i] & (1 << d):
                odd += 1
            else:
                even += 1
        add = (odd * even) % MOD * two_factor % MOD
        res = (res + add) % MOD
        two_factor = two_factor * 2 % MOD

    print(res)
