An arrangement for housing a large number of milking animals, each of which belongs to one of a plurality of groups, comprises a resting area (1) wherein the milking animals are allowed to rest; a feeding area (3) wherein the milking animals are fed; and a milking area (5) housing at least one milking robot for milking the milking animals, wherein the resting area (1) or the feeding area (3) is partitioned in sections (7, 9, 11, 13; 41, 43, 45, 47), the number of which corresponds to the number of the groups; and a device (19; 53) is provided for directing each of the milking animals moving towards the resting area (1) or the feeding area (3), which is partitioned in sections, into one of the sections depending on the group, to which the respective milking animal belongs, so that that each of said sections will house milking animals belonging to one of said groups.