One touch is only an alert
The inside of a Venus flytrap leaf has trigger hairs. Brush one hair once and the trap does not snap shut. Researchers at the University of Wurzburg describe that first touch as putting the trap in a ready-to-go mode, which avoids reacting to a possible false alarm.
A second touch closes it. Wikipedia's entry says the two touches have to come within about 20 seconds of each other, or one hair can be touched twice in quick succession. The trap itself then shuts in roughly a tenth of a second.
A short memory
The same entry says the plant remembers a first touch for a few seconds. That sits a little awkwardly beside the 20-second window, and sources give slightly different timings, so treat both numbers as approximate rather than exact.
Counting towards a meal
Closing is not the same as digesting. The Wurzburg team reported that after five triggers, glands on the inner surface begin producing digestive enzymes and nutrient transporters. The Wikipedia entry words this in two ways, as five further stimuli in its introduction and as five in total in its mechanism section, so the exact tally after closing is worded inconsistently there.
Why count at all? The researchers say the number of signals tells the plant about the size and nutrient content of the struggling prey, helping it balance the cost and benefit of hunting. Wikipedia likewise describes repeated triggering as a safeguard against wasting energy, and as confirmation that the prey is alive.

