Automata with Counters, Monoids and Equivalence