I'm not one of the site experts... but I had an idea that might work for you using Match
If you have your column of numbers in Column A, enter the formula =MATCH(1,A2:A19,0)-1 in Column B and copy to the end of your list.
If you look at the results in Column B you will see that each value of 1 in Column A has a result of 0 in Column B. The value immediately below the 0 in Column B is the number of cells between two instances of 1's in Column A. So I changed the MATCH formula into an IF statement.....
I don't know if there is a way to turn this around so your count total is at the bottom of each group. Hope this gives you some ideas at least.