The man is left with one apple. Before the seventh gate, he had (1+1)x2, or 4 apples. Before the sixth gate, he had (4+1)x2, or 10 apples. Before that, he had (10+1)x2, or 22 apples. Thus, the number of apples he had is as follows:
1,4,10,22,46,94,190,382. So, he started with 382 apples
☺☺☺☺