get the length of the saved states