Terrestrial Planet Formation. I. The Transition from Oligarchic Growth to Chaotic Growth