import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let m = n `div` 2
    print $ solve m as

solve 0 _ = 0
solve 1 as = maximum as
solve m as | odd l = max (solve (m-1) (take (l-2) as) + (last as)) (solve m (take (l-1) as))
           | otherwise = max (solve (m-1) (take (l-2) as) + (last as)) (sum (oddlist (init as)))
    where l = length as

oddlist (a : []) = a : []
oddlist (a : _ : as) = a : oddlist as