Not sure. Which accessor are you using specifically?
If you're talking about the SpriteCollectionData.Count property, then this is actually possible. The sprites are stored by ID to avoid any name resolving at any stage. The editor handles deleting of sparse values by nulling out the data - i.e. the slot still exists. Newly created sprites will then take over this empty space later. For the most part you don't have to care about this, or even be aware that this even happened.
The order of sprites / frames aren't guaranteed to match any particular order. If you'd like an ordered list, the simplest method to do this is to create a SpriteAnimation, create a clip, and add frames in the order you'd like them to appear in, and get the IDs out of this list at runtime.