#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
const long long mx = 3e5 + 3509;
long long stmin[mx][20];
long long stmax[mx][20];
vector<long long> pows = {1};
vector<long long> logi = {0, 0};
long long tree[4 * mx + 5];
vector<long long> dp;
void build(vector<long long> A) {
  for (long long i = 0; i < 20; i++) {
    pows.push_back(2 * pows.back());
  }
  for (long long i = 2; i < mx; i++) {
    logi.push_back(1 + logi[i / 2]);
  }
  long long n = (long long)A.size();
  for (long long i = 0; i < n; i++) {
    stmin[i][0] = A[i];
    stmax[i][0] = A[i];
  }
  for (long long lg = 1; lg <= logi[n]; lg++) {
    for (long long i = 0; i < n; i++) {
      stmin[i][lg] = min(stmin[i][lg - 1], stmin[i + pows[lg - 1]][lg - 1]);
      stmax[i][lg] = max(stmax[i][lg - 1], stmax[i + pows[lg - 1]][lg - 1]);
    }
  }
}
long long ansmin(long long l, long long r) {
  long long lg = logi[r - l + 1];
  return min(stmin[l][lg], stmin[r - pows[lg] + 1][lg]);
}
long long ansmax(long long l, long long r) {
  long long lg = logi[r - l + 1];
  return max(stmax[l][lg], stmax[r - pows[lg] + 1][lg]);
}
void buildt(long long v, long long l, long long r) {
  if (r - l == 1) {
    if (dp[l] == -1) {
      tree[v] = 100000000;
    } else {
      tree[v] = dp[l];
    }
  } else if (l >= r) {
    return;
  } else {
    long long mid = (l + r) / 2;
    buildt(2 * v + 1, l, mid);
    buildt(2 * v + 2, mid, r);
    tree[v] = min(tree[2 * v + 1], tree[2 * v + 2]);
  }
}
void upd(long long v, long long l, long long r, long long pos, long long x) {
  if (r - l == 1) {
    if (l == pos) {
      tree[v] = x;
    }
  } else if (l >= r) {
    return;
  } else if (l > pos || pos >= r) {
    return;
  } else {
    long long mid = (l + r) / 2;
    upd(2 * v + 1, l, mid, pos, x);
    upd(2 * v + 2, mid, r, pos, x);
    tree[v] = min(tree[2 * v + 1], tree[2 * v + 2]);
  }
}
long long answ(long long v, long long l, long long r, long long lq,
               long long rq) {
  if (l >= r || l >= rq || lq >= r) {
    return 10000000000;
  } else if (lq <= l && r <= rq) {
    if (tree[v] == -1) return 10000000000;
    return tree[v];
  } else {
    long long mid = (l + r) / 2;
    long long x1 = answ(2 * v + 1, l, mid, lq, rq);
    long long x2 = answ(2 * v + 2, mid, r, lq, rq);
    return min(x1, x2);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, s, l;
  cin >> n >> s >> l;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) cin >> A[i];
  build(A);
  dp.resize(n + 1);
  fill(dp.begin(), dp.end(), -1);
  for (long long i = 0; i < 4 * mx + 5; i++) tree[i] = 1000000000;
  buildt(0, 0, n + 1);
  upd(0, 0, n + 1, 0, 0);
  for (long long i = l - 1; i < n; i++) {
    long long left = -1;
    long long right = i - l + 1;
    while (right - left > 1) {
      long long mid = (left + right) / 2;
      long long mini = ansmin(mid, i);
      long long maxi = ansmax(mid, i);
      if (maxi - mini <= s) {
        right = mid;
      } else {
        left = mid;
      }
    }
    if (ansmax(left + 1, i) - ansmin(left + 1, i) <= s) {
      long long lel = left + 1;
      long long rer = i - l + 2;
      long long kek = answ(0, 0, n + 1, lel, rer);
      upd(0, 0, n + 1, i + 1, 1 + kek);
    }
  }
  long long p = answ(0, 0, n + 1, n, n + 1);
  if (p >= n + 1) p = -1;
  cout << p;
}

### Prompt

Generate a CPP solution to the following problem:

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;
const long long M = 1000000007;
const long long mx = 3e5 + 3509;
long long stmin[mx][20];
long long stmax[mx][20];
vector<long long> pows = {1};
vector<long long> logi = {0, 0};
long long tree[4 * mx + 5];
vector<long long> dp;
void build(vector<long long> A) {
  for (long long i = 0; i < 20; i++) {
    pows.push_back(2 * pows.back());
  }
  for (long long i = 2; i < mx; i++) {
    logi.push_back(1 + logi[i / 2]);
  }
  long long n = (long long)A.size();
  for (long long i = 0; i < n; i++) {
    stmin[i][0] = A[i];
    stmax[i][0] = A[i];
  }
  for (long long lg = 1; lg <= logi[n]; lg++) {
    for (long long i = 0; i < n; i++) {
      stmin[i][lg] = min(stmin[i][lg - 1], stmin[i + pows[lg - 1]][lg - 1]);
      stmax[i][lg] = max(stmax[i][lg - 1], stmax[i + pows[lg - 1]][lg - 1]);
    }
  }
}
long long ansmin(long long l, long long r) {
  long long lg = logi[r - l + 1];
  return min(stmin[l][lg], stmin[r - pows[lg] + 1][lg]);
}
long long ansmax(long long l, long long r) {
  long long lg = logi[r - l + 1];
  return max(stmax[l][lg], stmax[r - pows[lg] + 1][lg]);
}
void buildt(long long v, long long l, long long r) {
  if (r - l == 1) {
    if (dp[l] == -1) {
      tree[v] = 100000000;
    } else {
      tree[v] = dp[l];
    }
  } else if (l >= r) {
    return;
  } else {
    long long mid = (l + r) / 2;
    buildt(2 * v + 1, l, mid);
    buildt(2 * v + 2, mid, r);
    tree[v] = min(tree[2 * v + 1], tree[2 * v + 2]);
  }
}
void upd(long long v, long long l, long long r, long long pos, long long x) {
  if (r - l == 1) {
    if (l == pos) {
      tree[v] = x;
    }
  } else if (l >= r) {
    return;
  } else if (l > pos || pos >= r) {
    return;
  } else {
    long long mid = (l + r) / 2;
    upd(2 * v + 1, l, mid, pos, x);
    upd(2 * v + 2, mid, r, pos, x);
    tree[v] = min(tree[2 * v + 1], tree[2 * v + 2]);
  }
}
long long answ(long long v, long long l, long long r, long long lq,
               long long rq) {
  if (l >= r || l >= rq || lq >= r) {
    return 10000000000;
  } else if (lq <= l && r <= rq) {
    if (tree[v] == -1) return 10000000000;
    return tree[v];
  } else {
    long long mid = (l + r) / 2;
    long long x1 = answ(2 * v + 1, l, mid, lq, rq);
    long long x2 = answ(2 * v + 2, mid, r, lq, rq);
    return min(x1, x2);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, s, l;
  cin >> n >> s >> l;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) cin >> A[i];
  build(A);
  dp.resize(n + 1);
  fill(dp.begin(), dp.end(), -1);
  for (long long i = 0; i < 4 * mx + 5; i++) tree[i] = 1000000000;
  buildt(0, 0, n + 1);
  upd(0, 0, n + 1, 0, 0);
  for (long long i = l - 1; i < n; i++) {
    long long left = -1;
    long long right = i - l + 1;
    while (right - left > 1) {
      long long mid = (left + right) / 2;
      long long mini = ansmin(mid, i);
      long long maxi = ansmax(mid, i);
      if (maxi - mini <= s) {
        right = mid;
      } else {
        left = mid;
      }
    }
    if (ansmax(left + 1, i) - ansmin(left + 1, i) <= s) {
      long long lel = left + 1;
      long long rer = i - l + 2;
      long long kek = answ(0, 0, n + 1, lel, rer);
      upd(0, 0, n + 1, i + 1, 1 + kek);
    }
  }
  long long p = answ(0, 0, n + 1, n, n + 1);
  if (p >= n + 1) p = -1;
  cout << p;
}

```