Why is $\{\alpha: \alpha \mathrm{\ ordinal \ and \ \alpha \ equipotent \ with \ X}\}$ a set? Given a set $X$, we define
$$|X|:= \min\{\alpha: \alpha \mathrm{\ ordinal \ and \ \alpha \ equipotent \ with \ X}\}$$
Here equipotent means there is a bijection between both sets.
Why is $\{\alpha: \alpha \mathrm{\ ordinal \ and \ \alpha \ equipotent \ with \ X}\}$ a set in ZF(C)? What axioms does one use?
I tried to use replacement with well-orders on $X$ but I'm not sure if this work. I know one can associate to every well-order on $X$ a unique ordinal $\operatorname{Ord}(X)$ with $\operatorname{Ord}(X) \cong X$.
 A: This is indeed a set. Namely consider first the set $W$ of well-orders on $X$. 
Why is $W$ a set?
A well-order on $X$ is a binary relation, thus it is a subset of $X \times X$, i.e. an element of $P(X\times X)$. By the comprehension axiom (sometimes called separation), $$ W = \{ E \in P(X \times X) : E \text{ is a well-order on } X \}$$ is a set. 
You know already that for each well-order $E$ on $X$, there is a unique ordinal $\alpha$ so that $(X,E)$ is isomorphic to $(\alpha, <)$. Thus by applying the replacement scheme (which is indeed needed), we have that $$\{\alpha : \exists E \in W ( (X,E) \text{ is isomorphic to } (\alpha,<) \} $$ is a set. But this is exactly the set that you are interested in since any bijection $f$ from $X$ to an ordinal $\alpha$, induces the well-order $E_f$ on $X$, where $x E_f y$ iff $f(x) < f(y)$. $f$ is then also an isomorphism from $(X,E)$ to $(\alpha,<)$.
A: Let $\beta:=\mathsf{Ord}(\mathcal P(X))$.
Then $\{\alpha: \alpha \mathrm{\ ordinal \ and \ \alpha \ equipotent \ with \ X}\}$ is a subset of $\beta$ hence is a set by axiom of separation.
