if you are on a flush draw, you hold 2 hearts, and there are 2 hearts on the board. so, that leaves (13 total hearts - 4 you have) 9 hearts left.

if you are on a straight draw, you hold (say) , and the board has , then any 3 will help you, and any 8 will help you so thats 8 more outs. But, we allready counted the and the in the flush section

so we're left with 9(flush) + 8(straight) -2(overcount) = 15