How exactly do we explain “distinct objects” in the definition of set?

Wikipedia gives the following definition for sets:

A set is a well-defined collection of distinct objects.

But what does it mean by "distinct objects" here?

For example, we can say $\{A,B\}=\{\{1,2\},\{1,3\}\}$ is a set. So essentially by "distinct" we wanted to say $A\neq B$.

However, I think this is not enough. For example, can we say $\{\{a\},a\}$ is a set? I guess not. Just consider $\{$America, New York$\}$. It would be inconvenient to discuss problems when we put objects in different level of hierarchy together. So we should have $A\notin B$ and $B\notin A$ to say $A,B$ are distinct. But how about $\{\{\{a\},\emptyset\},a\}$?

• In set theory we do allow to 'mix' levels in this way. The only requirements is distinctness. – Ittay Weiss Apr 7 '17 at 7:09
• All of those “nested” sets are perfectly valid. In fact, modeling some important concepts such as ordered pair and the natural numbers in set theory depends on being able to construct such sets. – amd Apr 7 '17 at 7:19
• try to define what two objects being equal means, then distinct = ¬equal – JMP Apr 7 '17 at 7:22

Now, if we want to talk about formal definition of "distinct", it just means not equal. Equality is "built in" to the universe, so different objects are different. The axiom of extensionality tells us that sets are different when we can detect that with different elements. Namely, $\{0,1\}$ is distinct from $\{1,2\}$ because $0$ is an element of the one set but not the other. In the case we allow for non-sets, again, equality is something we just get from the rules of logic.
In fact $\{\{a\},a\}$ and $\{\{\{a\},\emptyset\},a\}\{\{\{a\},\emptyset\},a\}$ are indeed both examples of sets. Namely, in set theory, every set is an object as well. The 'hierarchy' as you call it depends interely on the context. Your example of $\{\text{America}, \text{New York}\}$ can be seen as a set of two English words. Or you can regard 'America' as the set of all cities in America, in which case New York $\in$ America, i.e. 'New York' is an element of the set 'America'.