Yunho is in poor health, so he takes medicine three times a day: morning, noon, and night. The medicine he picked up covers N days, so the strip holds 3N doses.

Yunho is a perfectionist, so he never pulls a dose out of the middle of the row of 3N packets. Each time he takes one dose from the front end or the back end of the row. The dose he takes has to be the kind he is due to swallow. He starts with the morning dose of day 1, then noon, then night, then the morning dose of day 2, and so on. If neither end holds the dose he is due to take, Yunho stops there.
Find the largest number of doses Yunho can swallow.