Let's solve this step by step:

1. The farmer starts with 17 sheep
2. The problem says "all but 9 die"
3. This means 9 sheep are left alive
4. So the number of sheep left is 9

The answer is 9 sheep.
