Introduction - If you have any usage issues, please Google them yourself
A simple microcontroller can control the relay and have counting function. The attached schematic diagram and program are not matched, but the principle is basically the same. Two programs, one for the reference program and the other for the program