#include <bits/stdc++.h>
using namespace std;
long long n, m, k, x, y, sizx, z, sizy, enx, eny, ans, len, second,
    segmax[400100], segmin[400100], a[100100], beh[100100], fro[100100];
void bldmax(long long pos, long long bb, long long ee) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb <= 1) {
    segmax[pos] = bb;
    return;
  }
  bldmax(l, bb, mid);
  bldmax(r, mid, ee);
  if (a[segmax[l]] >= a[segmax[r]])
    segmax[pos] = segmax[l];
  else
    segmax[pos] = segmax[r];
}
long long maxbegir(long long pos, long long bb, long long ee, long long bx,
                   long long ex) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb == ex - bx) return segmax[pos];
  if (ex <= mid) return maxbegir(l, bb, mid, bx, ex);
  if (bx >= mid) return maxbegir(r, mid, ee, bx, ex);
  long long LL = maxbegir(l, bb, mid, bx, mid);
  long long rr = maxbegir(r, mid, ee, mid, ex);
  if (a[LL] >= a[rr])
    return LL;
  else
    return rr;
}
void bldmin(long long pos, long long bb, long long ee) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb <= 1) {
    segmin[pos] = bb;
    return;
  }
  bldmin(l, bb, mid);
  bldmin(r, mid, ee);
  if (a[segmin[l]] <= a[segmin[r]])
    segmin[pos] = segmin[l];
  else
    segmin[pos] = segmin[r];
}
long long minbegir(long long pos, long long bb, long long ee, long long bx,
                   long long ex) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb == ex - bx) return segmin[pos];
  if (ex <= mid) return minbegir(l, bb, mid, bx, ex);
  if (bx >= mid) return minbegir(r, mid, ee, bx, ex);
  long long LL = minbegir(l, bb, mid, bx, mid);
  long long rr = minbegir(r, mid, ee, mid, ex);
  if (a[LL] <= a[rr])
    return LL;
  else
    return rr;
}
long long bs(long long bb, long long ee, long long az) {
  long long mm = (bb + ee) / 2;
  if (ee - bb <= 1) return bb;
  if (a[maxbegir(1, 0, n, az, mm + 1)] - a[minbegir(1, 0, n, az, mm + 1)] <= k)
    return bs(mm, ee, az);
  else
    return bs(bb, mm, az);
}
long long bs1(long long bb, long long ee, long long ta) {
  long long mm = (bb + ee) / 2;
  if (ee - bb <= 1) return ee;
  if (a[maxbegir(1, 0, n, mm, ta)] - a[minbegir(1, 0, n, mm, ta)] > k)
    return bs1(mm, ee, ta);
  else
    return bs1(bb, mm, ta);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k >> len;
  for (int i = 0; i < n; i++) cin >> a[i];
  bldmax(1, 0, n);
  bldmin(1, 0, n);
  ans = 1;
  enx = fro[0] = bs(0, n, 0);
  sizx = enx + 1;
  z = 0;
  if (sizx < len) return cout << -1, 0;
  while (enx != n - 1) {
    eny = fro[enx + 1] = bs(enx + 1, n, enx + 1);
    sizy = eny - enx;
    ans++;
    y = beh[eny] = bs1(-1, eny + 1, eny + 1);
    if (sizx + sizy + z < 2 * len) return cout << -1, 0;
    z = min(enx - bs1(-1, enx + 2, enx + 2) + 1, enx - x + 1 - len);
    x = max(x + len, y);
    enx = eny;
    sizx = enx - x + 1;
  }
  cout << ans;
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.

Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:

  * Each piece should contain at least l numbers.
  * The difference between the maximal and the minimal number on the piece should be at most s.



Please help Alexandra to find the minimal number of pieces meeting the condition above.

Input

The first line contains three space-separated integers n, s, l (1 ≤ n ≤ 105, 0 ≤ s ≤ 109, 1 ≤ l ≤ 105).

The second line contains n integers ai separated by spaces ( - 109 ≤ ai ≤ 109).

Output

Output the minimal number of strip pieces.

If there are no ways to split the strip, output -1.

Examples

Input

7 2 2
1 3 1 2 4 1 2


Output

3


Input

7 2 2
1 100 1 100 1 100 1


Output

-1

Note

For the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].

For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long n, m, k, x, y, sizx, z, sizy, enx, eny, ans, len, second,
    segmax[400100], segmin[400100], a[100100], beh[100100], fro[100100];
void bldmax(long long pos, long long bb, long long ee) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb <= 1) {
    segmax[pos] = bb;
    return;
  }
  bldmax(l, bb, mid);
  bldmax(r, mid, ee);
  if (a[segmax[l]] >= a[segmax[r]])
    segmax[pos] = segmax[l];
  else
    segmax[pos] = segmax[r];
}
long long maxbegir(long long pos, long long bb, long long ee, long long bx,
                   long long ex) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb == ex - bx) return segmax[pos];
  if (ex <= mid) return maxbegir(l, bb, mid, bx, ex);
  if (bx >= mid) return maxbegir(r, mid, ee, bx, ex);
  long long LL = maxbegir(l, bb, mid, bx, mid);
  long long rr = maxbegir(r, mid, ee, mid, ex);
  if (a[LL] >= a[rr])
    return LL;
  else
    return rr;
}
void bldmin(long long pos, long long bb, long long ee) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb <= 1) {
    segmin[pos] = bb;
    return;
  }
  bldmin(l, bb, mid);
  bldmin(r, mid, ee);
  if (a[segmin[l]] <= a[segmin[r]])
    segmin[pos] = segmin[l];
  else
    segmin[pos] = segmin[r];
}
long long minbegir(long long pos, long long bb, long long ee, long long bx,
                   long long ex) {
  long long mid = (ee + bb) / 2, l = pos * 2, r = l + 1;
  if (ee - bb == ex - bx) return segmin[pos];
  if (ex <= mid) return minbegir(l, bb, mid, bx, ex);
  if (bx >= mid) return minbegir(r, mid, ee, bx, ex);
  long long LL = minbegir(l, bb, mid, bx, mid);
  long long rr = minbegir(r, mid, ee, mid, ex);
  if (a[LL] <= a[rr])
    return LL;
  else
    return rr;
}
long long bs(long long bb, long long ee, long long az) {
  long long mm = (bb + ee) / 2;
  if (ee - bb <= 1) return bb;
  if (a[maxbegir(1, 0, n, az, mm + 1)] - a[minbegir(1, 0, n, az, mm + 1)] <= k)
    return bs(mm, ee, az);
  else
    return bs(bb, mm, az);
}
long long bs1(long long bb, long long ee, long long ta) {
  long long mm = (bb + ee) / 2;
  if (ee - bb <= 1) return ee;
  if (a[maxbegir(1, 0, n, mm, ta)] - a[minbegir(1, 0, n, mm, ta)] > k)
    return bs1(mm, ee, ta);
  else
    return bs1(bb, mm, ta);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k >> len;
  for (int i = 0; i < n; i++) cin >> a[i];
  bldmax(1, 0, n);
  bldmin(1, 0, n);
  ans = 1;
  enx = fro[0] = bs(0, n, 0);
  sizx = enx + 1;
  z = 0;
  if (sizx < len) return cout << -1, 0;
  while (enx != n - 1) {
    eny = fro[enx + 1] = bs(enx + 1, n, enx + 1);
    sizy = eny - enx;
    ans++;
    y = beh[eny] = bs1(-1, eny + 1, eny + 1);
    if (sizx + sizy + z < 2 * len) return cout << -1, 0;
    z = min(enx - bs1(-1, enx + 2, enx + 2) + 1, enx - x + 1 - len);
    x = max(x + len, y);
    enx = eny;
    sizx = enx - x + 1;
  }
  cout << ans;
  return 0;
}

```