#include <bits/stdc++.h>
using namespace std;
long long int a[100010];
long long lleft[100010], lleftret[100010], rright[100010], rrightret[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) cin >> a[i];
  lleft[0] = 0;
  lleftret[0] = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == 1)
      lleftret[i] = 0;
    else
      lleftret[i] = lleftret[i - 1] + a[i] - a[i] % 2;
    if (a[i] % 2)
      lleft[i] = lleft[i - 1] + a[i];
    else
      lleft[i] = lleft[i - 1] + a[i] - 1;
    lleft[i] = max(lleft[i], lleftret[i]);
  }
  rright[n - 1] = rrightret[n - 1] = 0;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i + 1] == 1)
      rrightret[i] = 0;
    else
      rrightret[i] = rrightret[i + 1] + a[i + 1] - a[i + 1] % 2;
    if (a[i + 1] % 2)
      rright[i] = rright[i + 1] + a[i + 1];
    else
      rright[i] = rright[i + 1] + a[i + 1] - 1;
    rright[i] = max(rright[i], rrightret[i]);
  }
  long long int res = 0;
  for (int i = 0; i < n; i++)
    res = max(res, max(lleftret[i] + rright[i], rrightret[i] + lleft[i]));
  cout << res << endl;
  return 0;
}
