#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long p_mod(long long a, long long b, long long c) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c;
    b >>= 1;
  }
  return ans;
}
int f_pow(int a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
bool cmp(long long a, long long b) { return a > b; }
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  long long ans1 = 0, ans2 = 0;
  long long maxx = 0;
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0)
      ans1 += a[i];
    else
      ans2 += a[i];
  }
  ans2 += a[0];
  maxx = max(ans1, ans2);
  for (int i = 0; i < n - 1; ++i) {
    if (i % 2 == 0) {
      ans1 -= a[i];
      ans1 += a[i + 1];
      maxx = max(ans1, maxx);
    } else {
      ans2 -= a[i];
      ans2 += a[i + 1];
      maxx = max(ans2, maxx);
    }
  }
  printf("%lld\n", maxx);
  return 0;
}
