a stateful counter using session types