As has been stated, the three secound count ends when the shot goes up. If an offensive player gets the rebound, then the three second count begins anew. If you have a shot followed by two or three putback attempts, you can have players in the key for quite a while, legally.