if __name__ == '__main__':
    MOD = 10 ** 9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in range(60):
        flag1 = sum([1 for x in a if x & (1 << i)])
        flag0 = n - flag1
        ans += (1 << i) * (flag1 * flag0)
        ans %= MOD
    print(ans)
