In reply to A. P. Edant.

Thanks for writing. It depends what you are counting. As written, 'count' records the number of tails before the appearance of the first heads. Thus 'count' can be 0, 1, 2, .... If you want to count the number of tosses before the appearance of the first heads, then you would need to add 1, as you point out, and 'count' would have the values 1, 2, 3,....