Grownups are well aware of the power of the slow count and its ability to shut down rambunctious behavior. (Think a teacher yelling “I’m going to count to five. . . ” to a rowdy classroom of students.) As it turns out, the venus flytrap employs a similar technique, counting to five before beginning the punishing process of digesting its prey, according to findings published last week in the journal Current Biology.

"The carnivorous plant Dionaea muscipula, also known as Venus flytrap, can count how often it has been touched by an insect visiting its capture organ in order to trap and consume the animal prey," study co-author Rainer Hedrich said in a press release.

Each D. muscipula trap is lined with sensitive, hairlike fibers that detect movement through changes in electricity. To find out how the flytraps were using that information, the researchers hooked D. muscipula plants up to electrical sensors, then fed them crickets. Each time a bug came into contact with these electrosensing fibers, the researchers found, the plant took note. The first time each insect made contact, the trap stayed open, but the plant went into “ready-to-go” mode, similar to a runner crouched at the starting line.

At the second touch, the plant’s jaws snapped shut—not tightly enough to kill the cricket, but enough to keep it from getting away. Here, the plant reset its tally and started counting from the beginning. 

“If you don’t panic, the trap will open,” Hedrich told New Scientist. “But like everybody, once you are trapped you panic, so you will try to escape – and once you are struggling, you touch the other hairs.”

After five hits, glands inside the trap started pumping out the digestive juices that would dissolve the cricket alive. The cricket’s bid for freedom was the very thing that spelled its downfall.

Why would the plants wait at all? First, to ensure that the first contact wasn’t a false alarm. Snapping shut and digesting food both require a lot of energy, and the plant doesn’t have room to make mistakes. Second, each instance of contact gives the plant information about the size of its prisoner, which allows it to decide if the prey is even worth it. A single trap can only reach up to about three inches, which means that a fat cricket could make a fine meal.

“It measures the touches to see what type of visitor it is,” Hedrich said in New Scientist. A bigger bug would be more work to contain and would require the production of more bug-eating juice, but the payoff would also be greater. The researchers say the math and cost-benefit analysis suggest a real process of calculation. Unconscious calculation, but calculation nonetheless.