#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000007LL;
const long long INF2 = 1000000007LL * 1000000007LL;
const long double EPS = 1e-9;
const int SIZE = 200100;
mt19937 rng(time(0));
uniform_int_distribution<int> uid(-1000000000, 1000000000);
long long n, a[SIZE];
long long sumOdd[SIZE], sumLeft[SIZE], sumRight[SIZE];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i < n; ++i) {
    sumOdd[i] = sumOdd[i - 1] + (a[i - 1] - !(a[i - 1] % 2));
    sumLeft[i] = sumLeft[i - 1] + (a[i - 1] - (a[i - 1] % 2));
    if (a[i - 1] == 1) sumLeft[i] = 0;
  }
  for (int i = n - 2; i >= 0; --i) {
    sumRight[i] = sumRight[i + 1] + (a[i] - (a[i] % 2));
    if (a[i] == 1) sumRight[i] = 0;
  }
  long long best = 0, ans = 0;
  int l = 0;
  for (int r = 0; r < n; ++r) {
    if (sumLeft[r] - sumOdd[r] > best) {
      best = sumLeft[r] - sumOdd[r];
      l = r;
    }
    long long sumR = sumRight[r] + sumOdd[r];
    ans = max(ans, sumR + best);
  }
  cout << ans;
  return 0;
}
