Bijection from ordered pairs of $[0,n]$ I am looking for a simple expression to convert ordered pairs from  $[0,n]$ to the first smallest subset of $\mathbb N$.
For example if $n = 3$:
$$ (0, 1) \rightarrow 0$$
$$ (0, 2) \rightarrow 1$$
$$ (0, 3) \rightarrow 2$$
$$ (1, 2) \rightarrow 3$$
$$ (1, 3) \rightarrow 4$$
$$ (2, 3) \rightarrow 5$$
What could be an explicit formula for that?
To rephrase, I am looking for a formula $f_n(i, j)$ where $0 \le i < j \le n$ such that $0 \le f_n(i, j) < \left ( ^{n}_{2}\right )$ and $f_n$ is bijective. I would also like if possible the inverse bijection to retrieve $i$ and $j$ from an image of $f_n$.
The values of the function do not matter as long as the set of values is the same.
Cantor pairing functions are not applicable here because the bijection is not infinite.

If you are lazy, a simple adaptation of the Cantor Pairing Function $\pi$ works quite well:
$$f(x,y):=\pi(x,y-x-1) = \frac{1}{2}y(y+1) - x - 1$$
As a bonus, it doesn't depend on $n$, so the same mapping can be extended to any $n$, without changing the resulting values.
Going backwards is quite easy too. Since $\frac{1}{2}y(y+1)-x-1 = \frac{1}{2}(y+\frac{1}{2})^2 - x - \frac{9}{8}$, if we want to "unpack" number $N$, we can simply calculate
$$y = \left\lceil \sqrt{2N + 9/4}-\frac{1}{2}\right\rceil$$
and then
$$x = \frac{1}{2}y(y+1)-1 - N$$
