Write counter.