The farmer has **9 sheep left**.

The phrase "all but 9 die" means that all of the sheep except for 9 died. So, **9 sheep are still alive**.
