#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
mt19937 rnd(time(0));
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n; i += 2) {
    long long cur = 0;
    long long mi = INT_MAX;
    for (long long j = i; j < n; j++) {
      if (j % 2 == 0) {
        cur += v[j];
      } else {
        cur -= v[j];
      }
      if (j % 2 == 1) {
        if (cur < 0) {
          ans += min(v[j], min(v[i], mi + 1));
          break;
        } else {
          ans += max(0ll, min(mi + 1 - cur, min(v[i], v[j])));
        }
        mi = min(mi, cur);
      }
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(10);
  long long T = 1;
  while (T-- > 0) {
    solve();
  }
  return 0;
}
