To divide a group of r items into n subgroups you only need n-1 walls.
Let | be a wall and o an item, then with r = 4 and n = 6 it can look like
|o||oo||o or maybe ooo||||o|
Number of distinct ways to arrange r items and n-1 walls is
(r + n - 1)!/(r!(n-1)!) = (r + n - 1) CHOOSE (r) = (r + n - 1) CHOOSE (n - 1)