Thanks Owen, but \$$(\mathbb{Z}/2, \cdot)\$$, which corresponds to the discussed example, when \$$f \circ f = f\$$, seems to be a monoid, because there is no inverse for \$$f\$$, right?

So \$$(\mathbb{Z}/2, +)\$$, \$$(\mathbb{Z}/2, \cdot)\$$ is a ring, but is called a field, and this is the source of my confusion :)