import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val as = new Array[Int](n)
    for (i <- as.indices) {
      as(i) = sc.nextInt()
    }
    
    
    val m = n / 2
    
    val dp = Array.ofDim[Long](n, m + 1, 2)
    
    for (i <- 0 until n) {
      for (j <- 0 until m + 1) {
        dp(i)(j)(0) = (-10000000000L)
        dp(i)(j)(1) = (-10000000000L)
      }
    }
    
    
    for (i <- 0 until n) {
      for (j <- 0 until m + 1) {
        //          if (i == 0) {
        //            dp(0)(j) = as(0)
        //          } else {
        //            dp(i)(j) = math.max(dp(i - 1)(j), dp(i - 1)(j - 1) + as(i))
        //          }
        if (i == 0) {
          dp(i)(0)(0) = 0
          dp(i)(1)(1) = as(i)
        } else if (j == 0) {
          dp(i)(j)(0) = 0
        } else {
          dp(i)(j)(0) = math.max(dp(i - 1)(j)(0), dp(i - 1)(j)(1))
          dp(i)(j)(1) = dp(i - 1)(j - 1)(0) + as(i)
        }
      }
    }
    println(math.max(dp(n - 1)(m)(0), dp(n - 1)(m)(1)))
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}