def xorsum(arr, n, modu = int(10e8 + 7)): 
    ans = 0
    for i in range(60): # elements in arr less than 2^60
        zc = oc = ind_sum = 0
        for j in range(n): 
            if (arr[j] % 2):
                oc += 1
            else:
                zc += 1
            arr[j] = int(arr[j] / 2) 
        ind_sum = oc * zc * (1 << i)
        ans += ind_sum
        ans %= modu
    return ans

if __name__ == "__main__":
    import sys
    in_arr = []
    for line in sys.stdin:
        in_arr.append([int(_) for _ in line.strip().split()])
    arr = in_arr[1]
    print(xorsum(arr, len(arr)))