You will probably need to use an auxiliary array as a ``buffer.''