#include <bits/stdc++.h>
using namespace std;
namespace io {
char c123, quu[55];
int qr;
template <class I>
inline void geti(I &x) {
  I f = 1;
  for (c123 = (getchar()); !isdigit(c123); c123 = (getchar())) {
    if (c123 == '-') f = -1;
  }
  for (x = 0; isdigit(c123); c123 = (getchar())) x = x * 10 + (c123 & 15);
  x *= f;
}
template <class I>
inline void puti(I x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) putchar('0');
  while (x) quu[++qr] = (x % 10) | 48, x /= 10;
  while (qr) putchar(quu[qr--]);
}
}  // namespace io
using namespace io;
const int N = 300010;
int n, k, a[N], b[N];
long long f[2];
int main() {
  geti(n);
  for (int i = 1; i <= n; i++) geti(a[i]);
  for (int i = 1; i <= n; i++) {
    int op = i % 2;
    f[op] += a[i] / 2;
    f[op ^ 1] += (a[i] + 1) / 2;
  }
  cout << min(f[0], f[1]);
  return 0;
}

### Prompt

Create a solution in CPP for the following problem:

You are given a Young diagram. 

Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1).

<image> Young diagram for a=[3,2,2,2,1].

Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogram, a domino is a 1 × 2 or 2 × 1 rectangle.

Input

The first line of input contain one integer n (1 ≤ n ≤ 300 000): the number of columns in the given histogram.

The next line of input contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 300 000, a_i ≥ a_{i+1}): the lengths of columns.

Output

Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram.

Example

Input


5
3 2 2 2 1


Output


4

Note

Some of the possible solutions for the example:

<image> <image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
namespace io {
char c123, quu[55];
int qr;
template <class I>
inline void geti(I &x) {
  I f = 1;
  for (c123 = (getchar()); !isdigit(c123); c123 = (getchar())) {
    if (c123 == '-') f = -1;
  }
  for (x = 0; isdigit(c123); c123 = (getchar())) x = x * 10 + (c123 & 15);
  x *= f;
}
template <class I>
inline void puti(I x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) putchar('0');
  while (x) quu[++qr] = (x % 10) | 48, x /= 10;
  while (qr) putchar(quu[qr--]);
}
}  // namespace io
using namespace io;
const int N = 300010;
int n, k, a[N], b[N];
long long f[2];
int main() {
  geti(n);
  for (int i = 1; i <= n; i++) geti(a[i]);
  for (int i = 1; i <= n; i++) {
    int op = i % 2;
    f[op] += a[i] / 2;
    f[op ^ 1] += (a[i] + 1) / 2;
  }
  cout << min(f[0], f[1]);
  return 0;
}

```