I thought the bowl on the table may be connected to an electronic scale. When the spec takes the buttons, obviously the weight will change and someone works out the number of buttons left in the bowl. This could then be told to Derren through several methods - ie a hidden earpiece or something!
...this is my theory - but I am sure it must be simpler than this!
I've seen something similiar performed with Smarties (ok - there are less Smarties in a tube) but still impressive.