#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MAX = 1e9 + 5;
int i, j, k, n, m;
long long Right[N][2], Left[N][2], ans, C[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) scanf("%lld", &C[i]);
  for (int i = n; i >= 1; i--) {
    Right[i][0] = (C[i] != 1) * Right[i + 1][0] + C[i] - (C[i] & 1);
    Right[i][1] = max(Right[i + 1][0], Right[i + 1][1]) + C[i] - !(C[i] & 1);
  }
  for (int i = 1; i <= n; i++) {
    Left[i][0] = (C[i - 1] != 1) * Left[i - 1][0] + C[i - 1] - (C[i - 1] & 1);
    Left[i][1] =
        max(Left[i - 1][0], Left[i - 1][1]) + C[i - 1] - !(C[i - 1] & 1);
  }
  for (int i = 1; i <= n; i++)
    ans = max(max(ans, max(Left[i][0], Left[i][1]) + Right[i][0]),
              max(Right[i][0], Right[i][1]) + Left[i][0]);
  cout << ans << '\n';
  return 0;
}
