#include <bits/stdc++.h>
using namespace std;
long long d[100500][2], dr[100500][2];
int a[100500];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int br = a[i - 1];
    d[i][0] = br - !(br & 1) + max(d[i - 1][0], d[i - 1][1]);
    if (br > 1) d[i][1] = br - (br & 1) + d[i - 1][1];
  }
  for (int i = n - 2; i >= 0; i--) {
    int br = a[i];
    dr[i][0] = br - !(br & 1) + max(dr[i + 1][0], dr[i + 1][1]);
    if (br > 1) dr[i][1] = br - (br & 1) + dr[i + 1][1];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, d[i][1] + dr[i][1]);
    ans = max(ans, d[i][0] + dr[i][1]);
    ans = max(ans, d[i][1] + dr[i][0]);
  }
  cout << ans << endl;
  return 0;
}
