main = do
  li <- getLine
  let n = read li
  li <- getLine
  let as = map read $ words li
  let ans = compute n as
  print ans

{-
偶数個のとき、奇数番目の和と偶数番目の和の大きい方。
奇数個のとき、1,2,3,4,5 は 1+3, 2+4, 3+5 の3つのどれか、ではなくて、
2+4の側と、1+3+5から最小値を除いたものの大きい方。
-}

compute :: Int -> [Int] -> Int
compute n as
  | even n = max (sum es) (sum os)
  | True   = max (sum es - minimum es) (sum os)
  where
    divide (x:y:xs) = (x:ps,y:qs) where (ps,qs) = divide xs
    divide xs = (xs,[])
    (es,os) = divide as