There are grids in a row. Two people A and B play a game with these grids. At first, they mark each odd-numbered grid from the left with A's name, and each even-numbered grid from the left with B's name. Then, starting with the player A, they take turns performing the following action: One should select two grids marked with his/her own name, such that these two grids are not adjacent, and all grids between them are marked with the opponent's name. Then, change the name in all the grids between those two grids to one's own name.
Two people take turns until one can not perform anymore. Find the largest positive integer satisfying the following condition: No matter how B acts, A can always make sure that there are at least grids marked with A's name.