Define $R(0)=0=\emptyset, R(n+1)=P(R(n))$ and $R(\omega) = \cup_{n < \omega} R(n)$. Thus $R(\omega)$ is the set of all sets, which are build out of finitely many braces and $0$.
Consider the following relation $E$ on $\omega$: If and only if the $n$th number in the binary representation of $m$ is $1$, then $n E m$. Now I want to construct an isomorphism $(R(\omega),\in) \cong (\omega,E)$ [This is an exercise in Kunen's set theory]. After some playing around I've come up with the following definition:
$g : R(\omega) \to \omega, g(x) = \sum_{y \in x} 2^{g(y)}$.
This is a well-defined recursion, since $rank(y) < rank(x)$. If $g$ is injective, then it is easy to see that $x \in y \Leftrightarrow g(x) E g(y)$. However I don't see this; neither why $g$ is surjective.