The IEC61131 norm, supports 5 different programming languages, so you can choose the best of them to solve the problem.
In LD (Ladder Diagram) you can use the ADD block and the program would be like in the picture. As you see the LD program has two different rungs, in the first, the program acts exactly as in the C program. If the LI0 is active the counter is increased at every program loop. In the second the counter count the times the LI1 becomes active.
In ST (Structured Text) you can write a program in a very similar way than the C language. So the program would be like in the picture.
Attached the print and the source code of a LogicLab project that manages the counter, you can test it directly on the PLC simulator.