#include <bits/stdc++.h>   using namespace std;   long long L[100005], R[100005], odd[100005], s[100005], dp[100005], ans = 0;   int n;   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) scanf( %I64d , &s[i]);     L[0] = 0;     for (int i = 1; i < n; i++) {       if (s[i] == 1)         L[i] = 0;       else         L[i] = L[i - 1] + s[i] / 2 * 2;     }     R[n - 1] = 0;     for (int i = n - 2; i >= 0; i--) {       if (s[i + 1] == 1)         R[i] = 0;       else         R[i] = R[i + 1] + s[i + 1] / 2 * 2;     }     dp[0] = 0;     for (int i = 1; i < n; i++) {       dp[i] = max(dp[i - 1] + (s[i] - 1) / 2 * 2 + 1, L[i]);     }     for (int i = 0; i < n; i++) {       ans = max(ans, dp[i] + R[i]);     }     printf( %I64d n , ans);     return 0;   }   