#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const long long MOD = 1000000007ll;
const long double PI = acos(-1.0);
const long long INF = 2000000000000000000ll;
const long double EPS = 1e-9;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
T sqr(T a) {
  return a * a;
}
bool pal(string &x) {
  int n = x.length();
  for (int i = 0; i < n / 2; i++) {
    if (x[i] != x[n - i - 1]) return 0;
  }
  return 1;
}
int tdp[111111 * 4];
int tmin[111111][20];
int tmax[111111][20];
int dp[111111];
int a[111111];
int n, s, l;
inline void build() {
  for (int j = 1; (1 << j) <= n; j++) {
    for (int i = 1; i + (1 << j) - 1 <= n; i++) {
      tmin[i][j] = min(tmin[i][j - 1], tmin[i + (1 << (j - 1))][j - 1]);
      tmax[i][j] = max(tmax[i][j - 1], tmax[i + (1 << (j - 1))][j - 1]);
    }
  }
}
inline int getmin(int i, int j) {
  int k = (int)log2(j - i + 1);
  return min(tmin[i][k], tmin[j - (1 << k) + 1][k]);
}
inline int getmax(int i, int j) {
  int k = (int)log2(j - i + 1);
  return max(tmax[i][k], tmax[j - (1 << k) + 1][k]);
}
inline void update(int pos, int val, int v = 1, int tl = 0, int tr = n) {
  if (tl == tr) {
    tdp[v] = val;
    return;
  }
  int tm = (tl + tr) >> 1;
  if (pos > tm)
    update(pos, val, v * 2 + 1, tm + 1, tr);
  else
    update(pos, val, v * 2, tl, tm);
  tdp[v] = min(tdp[v * 2], tdp[v * 2 + 1]);
}
inline int mindp(int l, int r, int v = 1, int tl = 0, int tr = n) {
  if (l > r) return inf;
  if (tl == l && tr == r) return tdp[v];
  int tm = (tl + tr) >> 1;
  return min(mindp(l, min(tm, r), v * 2, tl, tm),
             mindp(max(l, tm + 1), r, v * 2 + 1, tm + 1, tr));
}
void solve() {
  scanf("%d%d%d", &n, &s, &l);
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", a + i);
    tmin[i][0] = a[i];
    tmax[i][0] = a[i];
  }
  build();
  update(0, 0);
  for (int i = 1; i < n + 1; i++) {
    int l = 1, r = i, ans = r + 1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (getmax(mid, i) - getmin(mid, i) <= s) {
        ans = min(ans, mid);
        r = mid - 1;
      } else
        l = mid + 1;
    }
    int x = mindp(ans - 1, i - ::l);
    dp[i] = x + 1;
    update(i, dp[i]);
  }
  if (dp[n] > n)
    printf("%d", -1);
  else {
    printf("%d", dp[n]);
  }
}
int main() {
  int t = 1;
  while (t--) solve();
  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;
const int inf = 2000000000;
const long long MOD = 1000000007ll;
const long double PI = acos(-1.0);
const long long INF = 2000000000000000000ll;
const long double EPS = 1e-9;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
T sqr(T a) {
  return a * a;
}
bool pal(string &x) {
  int n = x.length();
  for (int i = 0; i < n / 2; i++) {
    if (x[i] != x[n - i - 1]) return 0;
  }
  return 1;
}
int tdp[111111 * 4];
int tmin[111111][20];
int tmax[111111][20];
int dp[111111];
int a[111111];
int n, s, l;
inline void build() {
  for (int j = 1; (1 << j) <= n; j++) {
    for (int i = 1; i + (1 << j) - 1 <= n; i++) {
      tmin[i][j] = min(tmin[i][j - 1], tmin[i + (1 << (j - 1))][j - 1]);
      tmax[i][j] = max(tmax[i][j - 1], tmax[i + (1 << (j - 1))][j - 1]);
    }
  }
}
inline int getmin(int i, int j) {
  int k = (int)log2(j - i + 1);
  return min(tmin[i][k], tmin[j - (1 << k) + 1][k]);
}
inline int getmax(int i, int j) {
  int k = (int)log2(j - i + 1);
  return max(tmax[i][k], tmax[j - (1 << k) + 1][k]);
}
inline void update(int pos, int val, int v = 1, int tl = 0, int tr = n) {
  if (tl == tr) {
    tdp[v] = val;
    return;
  }
  int tm = (tl + tr) >> 1;
  if (pos > tm)
    update(pos, val, v * 2 + 1, tm + 1, tr);
  else
    update(pos, val, v * 2, tl, tm);
  tdp[v] = min(tdp[v * 2], tdp[v * 2 + 1]);
}
inline int mindp(int l, int r, int v = 1, int tl = 0, int tr = n) {
  if (l > r) return inf;
  if (tl == l && tr == r) return tdp[v];
  int tm = (tl + tr) >> 1;
  return min(mindp(l, min(tm, r), v * 2, tl, tm),
             mindp(max(l, tm + 1), r, v * 2 + 1, tm + 1, tr));
}
void solve() {
  scanf("%d%d%d", &n, &s, &l);
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", a + i);
    tmin[i][0] = a[i];
    tmax[i][0] = a[i];
  }
  build();
  update(0, 0);
  for (int i = 1; i < n + 1; i++) {
    int l = 1, r = i, ans = r + 1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (getmax(mid, i) - getmin(mid, i) <= s) {
        ans = min(ans, mid);
        r = mid - 1;
      } else
        l = mid + 1;
    }
    int x = mindp(ans - 1, i - ::l);
    dp[i] = x + 1;
    update(i, dp[i]);
  }
  if (dp[n] > n)
    printf("%d", -1);
  else {
    printf("%d", dp[n]);
  }
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}

```