How can I compute the 'average rank' of an infinite set? Note: I will use $\in^n$ will to indicate that an object "is an element of an element of an..." of a set. e.g. $x\in^4 X$ means that there exist $X_1,\ldots,X_3$ such that $x\in X_1\in X_2\in X_3\in X$. Likewise $x\in^1 X\iff x\in X$, and $x\in^0 X\iff x\notin X$. If you want to get really crazy with it, you might also have $x\in^{-1}X\iff x\in X^\complement$

The rank of a set $X$ is given by the largest $n$ such that there exists an $x$ for which $x\in^n X$. The empty set has rank $0$, the set containing the empty set has rank $1$, and so forth.
Suppose that I have two sets $A_1=\{a,\{b\}\}$ and $A_2=\{\{a\},\{b\}\}$, where, for argument's sake, $a$ and $b$ are urelements. Both sets have rank $2$, but their structures differ in an obvious way. I want to clarify this difference in a way that still gets the idea of nested sets and rank across. So I thinks to myself "why not come up with an average rank?" 
Then, after thirty seconds, I write down the formula...
$$ark(X)=\frac{1}{|X|}\sum_{x\in X} rk(x)+1\qquad: X\neq\emptyset$$
(Note: see second edit)
Sure enough, the average rank of $A_1$ is $1.5$, while the average rank of $A_2$ is $2$ - I have my distinction.
Great! Of course, this only works for finite sets, and I'm not in preschool anymore; so how do I compute the average rank of an infinite set?

Edit:
The 'rank' (not the 'average rank') is intended to be the same as ordinal rank in the Von Neumann universe. The use of $\in^n$ and 'average rank' is meant to elaborate upon the structure of arbitrarily complicated nested sets without going into to much detail.
The average rank of a set is not unique and on its own is insufficient to describe the set. Paired with the [ordinal] rank, however, the average rank gives a rough indication of the how much information is encoded in the way a particular set is structured (in terms of nesting), its 'homogeneity', or complexity. A reasonable analogy might be made with multilevel lists, trees, or phylogenies.
When computing the average rank I treated the rank of each set (and its cardinality) as a real number. Obviously, this only makes sense if both the rank and cardinality are finite - hence the question.

Edit:
Upon reflection, it makes more sense to define the average rank recursively, so...
$$ark(X)=\frac{1}{|X|}\sum_{x\in X} ark(x)+1\qquad: X\neq\emptyset$$
...with $ark(z)=ark(\emptyset)=0$ for all urelements $z$. This way, if, for example, $A_1=\{a,\{\{a\},\{b\}\}\}$ and $A_2=\{a,\{a,\{b\}\}\}$, we'll have $ark(A_1)=2$ and $ark(A_2)=1.75$ (using the original formula, the average rank of $A_1$ and $A_2$ would both be $2$)

Note: I find the notation $\in^n$ extremely intuitive and useful for dealing with nested sets. It also saves me a lot of space. What does everyone else think about this notation? Is it helpful, or should I write it a different way?
 A: There are several things here.


*

*There's no reasonable way to take an infinite sum here. For one, cardinals do not admit inverses, and since ordinals measure order and cardinals measure cardinality, it is unclear if you mean that the sum itself is an ordinal or a cardinal summation, and if it is an ordinal sum, what is the order on $X$, etc. You could argue that we want to talk about this in the surreal numbers. But there's no reason to think that the sum is convergent.

*There is a notion of rank in set theory. And it is a global one, rather than a notion particular to each specific set. $\varnothing$ has rank $0$, and a set $A$ has rank of some ordinal $\alpha$ if $\alpha$ is the smallest ordinal such that not $a\in A$ has rank $\geq\alpha$. You can find out more when reading about the von Neumann hierarchy.

*The question when two sets are "isomorphic" is not a trivial one to define. But I think that what you want is to consider the transitive closures of two sets and ask if those are somehow isomorphic modulo some identification of some objects. Where the transitive closure of a set $A$ can be defined as $\{a\mid\exists n\in\Bbb N: a\in^n A\}$, using your notation, or define $A_0=A$ and $A_{n+1}=\bigcup A_n$, then the transitive closure is $\bigcup\{A_n\mid n\in\Bbb N\}$ (remember: in set theory, everything is a set, and if you fancy urelements, define $\bigcup$ in the obvious way that ignores the urelements).
I hope those insights are helpful.
