Out of the 40 children taking part in the Halloween celebration, 80% were allowed to draw jelly beans from the bag, a total of 80/100*40=<<80/100*40=32>>32 children.
If each of the 32 children drew two jelly beans out of the bag, they drew a total of 32*2=<<32*2=64>>64 jelly beans from the bag.
The total number of jelly beans that remained is 100-64=<<100-64=36>>36
#### 36