Disclosed is an assembly for sorting livestock, particularly cattle. The assembly has a passageway, delimited by side delimitations, to transport livestock from a first space to a second space. A gate system (3) is mounted in the passageway, the gate system has at least one self-closing gate leaf (6a, 6b) which is movable between a closed position and one or more open positions, including a pass position wherein for an animal from the livestock passage to the second space is possible. The gate system also has means for counting the number of animals which have passed through the passageway to the second space, wherein the counting means are configured for issuing a count signal as a function of a movement, observed by observation means, of the gate leaf (6a, 6b).