A shepherd had twenty sheep, out of which, all but thirteen died.

Can you tell us how many sheep was he left with?

He was left with thirteen sheep.

The phrase "all but thirteen died" actually means that all except thirteen died.