If you need to know the number of History states in the active document just use this script
var history_number = app.activeDocument.historyStates.length;
alert(history_number );
But if you need the main number of history states in the photoshop preferences use this one
var Hsstnum = app.preferences.numberOfHistoryStates;
alert (Hsstnum);