You are given an array of n integers. Each number is guaranteed to be in the range [0, n-1], and exactly one number is repeated once. Write a program to find and print the repeated number.
You cannot modify the array and cannot use extra memory (O(1) space).