Counting relay