Stack size counting