#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  long long ans = 0;
  for (int i = 0; i < n; i += 2) {
    long long l = 1, r = c[i];
    for (int j = i + 1; j < n; j++) {
      if (j % 2 == 1) {
        ans += max(0LL, min(r, c[j]) - l + 1);
        l = max(l - c[j], 0LL);
        r -= c[j];
      } else {
        l += c[j];
        r += c[j];
      }
    }
  }
  cout << ans << endl;
}
