This is a typical use of relations in an assembly. I'm using Creo 4, but I doubt very much the philosophy behind this type of thing has changed ever in the history of Pro/E -> Creo.
The general method of doing something like this is:
(1) Define your pattern, with a definition that won't "break" if you change the number of components.
(2) Select the pattern and look at its dimensions. One of those is the number of components in the format "XX COMPONENTS".
(3) Click on the XX COMPONENTS dimension and in the ribbon it will tell you the name of that dimension.
(4) Create a relation that uses the "LENGTH" dimension/parameter from your assembly to calculate the number of components (rails) you need, something like:
numRails = ceil ( LENGTH / lengthRail )
The "ceil" is so that your rail count will round up to the next largest integer number. All of the operands in the equation are assumed to have been renamed to something more understandable than the default "d10", "d1234" and the like.
You might even find that you want to define the spacing of the rails using the rail length, so you could change that (use a different standard rail) and have everything automatically update, etc. I really find this sort of thing very helpful in beginning stages of the design. The more stuff I can define so I avoid the "Oh no, I forgot to increase the number of this part when I updated the assembly" errors, the better.