11.
Let H be the number of comic books Harry started with.
He swapped 5 of his for 7 of Jenny's, so:
- He gave 5 to Jenny, meaning he now has: H - 5
- Received 7 from Jenny, meaning he now has: (H - 5) + 7 = H - 5 + 7 = H + 2
He bought 8 from the shop, so:
- He has 8 more, meaning he now has: (H + 2) + 8 = H + 2 + 8 = H + 10
He gave 9 to Tom, so:
- He has 9 fewer, meaning he now has: H + 10 - 9 = H + 1
He how has 12, so:
H + 1 = 12
→ H = 11