Call the number of cookies x
There are 7x/8 almond cookies, he gave away 1/2 * 7x/8 = 7x/16
There are x/8 chocolate cookies, he gave away 5/8 * x/8 = 5x/64
7x/16 + 5x/64 = 132
33x/64 = 132
x = 256
Note that 256 = 2^(8). You can tell without calculation that the number has to have lots of factors of 2, so if you were to guess then 256 would be high on the list.