def main():
    # input
    import sys
    input = sys.stdin.readline
    MAX = 10**9+7

    n = int(input())
    a = tuple(map(int, input().split()))

    li = [0]*61
    for i in a:
        for ind, j in enumerate(bin(i)[:1:-1]):
            li[ind] += int(j)

    ans = 0
    bit = 1
    for i in li:
        ans += bit * i * (n-i)
        bit *= 2
    print(ans%MAX)

    # calc



if __name__ == '__main__':
    main()
