cantor pairing function as a perfect hash