It may be easier to write a bijection , so that is a bijection. For example, take

It remains to find a bijection . The standard one is the Cantor pairing function

This last function makes precise the usual snake-like enumeration diagram for .

The function you want is . Since each function in the composition is a bijection, the result is also a bijection.