#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
long long n, db[MAXN], drb[MAXN], a[MAXN], d[MAXN], dr[MAXN];
long long ans;
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) cin >> a[i];
  for (int i = 1; i < n; i++)
    if (a[i - 1] > 1) db[i] = db[i - 1] + (a[i - 1] - (a[i - 1] % 2));
  for (int i = n - 2; i >= 0; i--)
    if (a[i] > 1) drb[i] = drb[i + 1] + (a[i] - (a[i] % 2));
  for (int i = n - 2; i >= 0; i--)
    d[i] = max(drb[i], d[i + 1] + (a[i] - ((a[i] + 1) % 2)));
  for (int i = 1; i < n; i++)
    dr[i] = max(db[i], dr[i + 1] + (a[i - 1] - ((a[i - 1] + 1) % 2)));
  for (int i = 0; i < n; i++) {
    ans = max(ans, dr[i] + drb[i]);
    ans = max(ans, d[i] + db[i]);
  }
  cout << ans;
}
