Pattern Mountain No. of Spaces doubt

Not able to crack number of spaces , refer to line 16to18 of the given code.