What year did ancient Egypt rule?

They began ruling from 2649 BC and they ended in 362 BC before the Greek/Romans came.