Encoding 16 elements : size=11000
0: 11111111111111111111111
1: 111111111111111111111111
2: 111111111111111111111111
3: 000000000000000000110000
4: 100000
5: 000011
6: 10
7: 01
8: 1
9: 1
10: 1
11: 0
[the remaining zeroes are skipped]

Encoding 5 elements : size=00001
0: [skipping 0]
1: 0
[the remaining zeroes are skipped]

Encoding 1 elements : size=00001
0: [skipping 0]

Encoding 10 elements : size=11000
0: 11111111111111111111111
1: 111111111111111111111111
2: 111111111111111111111111
3: 000000000000000000110000
4: 100000
5: 000011
6: 10
7: 01
8: 1
9: 1

Result : 249 bits


Decoding 16 elements : size=11000
0: 11111111111111111111111
1: 111111111111111111111111
2: 111111111111111111111111
3: 000000000000000000110000
4: 100000
5: 000011
6: 10
7: 01
8: 1
9: 1
10: 1
11: 0[clearing the rest of the destination]

Decoding 5 elements : size=00001
0: [skipping 0]

1: 0[clearing the rest of the destination]

Decoding 1 elements : size=00001
0: [skipping 0]

Decoding 10 elements : size=11000
0: 11111111111111111111111
1: 111111111111111111111111
2: 111111111111111111111111
3: 000000000000000000110000
4: 100000
5: 000011
6: 10
7: 01
8: 1
9: 1