When do stars leave the main sequence?