Can anyone give me idea of getting input 'N' number of times with a space difference between every input.

Forexample:

1 2 3 4 . . .

Note: We don't know the 'N' initially and i want to get input exactly 'N' number of times.

Kindly give me an idea.

Thanks