#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], dp2[100005], dp21[100005], dp212[100005], ans;
int main() {
  cin >> n;
  n--;
  for (int i = 1; i <= n; i++) scanf("%lld", a + i);
  for (int i = 1; i <= n + 1; i++)
    if (a[i] != 1) dp2[i] = dp2[i - 1] + a[i] - (a[i] % 2);
  for (int i = 1; i <= n + 1; i++)
    dp21[i] = max(dp21[i - 1], dp2[i - 1]) + a[i] - (a[i] % 2 == 0);
  for (int i = 1; i <= n + 1; i++)
    if (a[i] != 1)
      dp212[i] = max(dp21[i - 1], dp212[i - 1]) + a[i] - (a[i] % 2);
  for (int i = 1; i <= n + 1; i++)
    ans = max(ans, max(dp212[i], max(dp2[i], dp21[i])));
  cout << ans << endl;
  return 0;
}
