Method of dividing a group of metal bars into a first and a second subgroup, the first subgroup having a prefixed number of bars; the method, comprising - collecting a group of metal bars in a single layer, the number of metal bars in the group being higher than the prefixed number; - providing a counter, the counter comprising a surface scanner configured for providing topological data representing scanned surface profiles of objects, and a computer system functionally connected to the scanner; - scanning the surface of the group of metal bars by the scanner while moving the scanner along a line across the group of metal bars, determining relative position coordinates of the scanner repeatedly during the moving, and providing the scanning data signals as well as the relative position coordinates to the computer system; by the computer system automatically - relating the scanning signals to position coordinates and calculating a surface profile of the group of the metal bars in the computer system; - in the surface profile determining the relative positions of the metal bars and of the spaces between the metal bars, and counting the metal bars; - dividing the group of metal bars into a first subgroup of the prefixed number of bars and a second, subgroup of remaining bars, - counting the spaces between the bars and as a result of the counting determining a particular space that is located between the first subgroup and the second subgroup of bars and determining the position of the particular space; - locating a separation edge at the particular space; the separation edge having a first side and a second opposite side relatively to a vertical plane; - separating the first subgroup from the second subgroup by providing only the first subgroup of bars on the first side of the separation edge and the second subgroup only on the second side of the separation edge. - collecting a group of metal bars in a single layer, the number of metal bars in the group being higher than the prefixed number; - providing a counter, the counter comprising a surface scanner configured for providing topological data representing scanned surface profiles of objects, and a computer system functionally connected to the scanner; - scanning the surface of the group of metal bars by the scanner while moving the scanner along a line across the group of metal bars, determining relative position coordinates of the scanner repeatedly during the moving, and providing the scanning data signals as well as the relative position coordinates to the computer system; by the computer system automatically - relating the scanning signals to position coordinates and calculating a surface profile of the group of the metal bars in the computer system; - in the surface profile determining the relative positions of the metal bars and of the spaces between the metal bars, and counting the metal bars; - dividing the group of metal bars into a first subgroup of the prefixed number of bars and a second, subgroup of remaining bars, - counting the spaces between the bars and as a result of the counting determining a particular space that is located between the first subgroup and the second subgroup of bars and determining the position of the particular space; - locating a separation edge at the particular space; the separation edge having a first side and a second opposite side relatively to a vertical plane; - separating the first subgroup from the second subgroup by providing only the first subgroup of bars on the first side of the separation edge and the second subgroup only on the second side of the separation edge.