Is this possible with Hugo?

You could do it via a render hook:

But you would need to keep track of the count yourself (via .Page.Scratch)