#include <bits/stdc++.h>
using namespace std;
int n, a[100100];
long long dp[100100][4];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) scanf("%d", a + i);
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[n - 1][3] = 0;
  dp[n - 1][4] = 0;
  for (int i = 1; i < n; i++) {
    long long t = a[i - 1];
    if (t > 1) dp[i][1] = dp[i - 1][1] + (t / 2) * 2;
    if (!(t & 1)) t--;
    dp[i][0] = t + max(dp[i - 1][0], dp[i - 1][1]);
  }
  for (int i = n - 2; i >= 0; i--) {
    long long t = a[i];
    if (t > 1) dp[i][3] = dp[i + 1][3] + (t / 2) * 2;
    if (!(t & 1)) t--;
    dp[i][2] = t + max(dp[i + 1][3], dp[i + 1][2]);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++)
    ans = max(max(ans, dp[i][1] + dp[i][3]),
              max(dp[i][1] + dp[i][2], dp[i][0] + dp[i][3]));
  cout << ans << endl;
  return 0;
}
