Implemented logic to get backstack count