using System.Collections.Generic;
public static void Main()
var input = "d4 d3 52 ba 00 3e 80 c8 00 06 3a 45 cb 83 3b bc 6f e7 bd 61 3a 36 db 71 a6 5f a9 ea 49 a1 5b d6 67 85 e9 c3 c1 3e ca 74 72 fe da a8 88 c0 80 00 01 5d cb 43 6a 07 5a 98 9e 8a cb ec";
var hexNumbers = input.Split(' ');
var numbers = new List<int>();
Func<string, string> toBinary = (i) => Convert.ToString(Convert.ToInt64(i, 16), 2).PadLeft(8, '0');
for(int i = 0; i < hexNumbers.Count(); i += 2)
var number = Convert.ToInt32(toBinary(hexNumbers[i]) + toBinary(hexNumbers[i+1]), 2);
Console.WriteLine(hexNumbers[i] + " (" + toBinary(hexNumbers[i]) + ") + " + hexNumbers[i+1] + " (" + toBinary(hexNumbers[i+1]) + ") = " + number.ToString().PadRight(5, ' ') + " (" + toBinary(hexNumbers[i])+ " " + toBinary(hexNumbers[i+1]) + ")");
var sumBinary = Convert.ToString(numbers.Sum(), 2);
Console.WriteLine("\nInt full sum:");
Console.WriteLine(numbers.Sum());
Console.WriteLine("Binary full sum:");
Console.WriteLine(sumBinary);
var cut = sumBinary[^16..];
Console.WriteLine("\nInt cutted sum:");
Console.WriteLine(Convert.ToInt32(cut, 2));
Console.WriteLine("Binary cutted sum:");
Console.WriteLine("Checksum:");
var reversed = ~Convert.ToInt32(cut, 2);
Console.WriteLine(Convert.ToString(reversed, 2)[^16..]);