#include <bits/stdc++.h>
using namespace std;
const long long maxx = 1e5 + 20, mxsg = 2e6 + 2, inf = 3e12 + 6;
long long st1[mxsg], st2[mxsg], st3[mxsg];
long long n, s, l, a[maxx], t = 0, dp[maxx];
void modify1(long long x, long long k, long long id = 1, long long l = 0,
             long long r = n) {
  if (l + 1 == r) {
    st1[id] = k;
    return;
  }
  long long mid = (l + r) / 2;
  if (x < mid)
    modify1(x, k, id * 2, l, mid);
  else
    modify1(x, k, id * 2 + 1, mid, r);
  st1[id] = min(st1[id * 2], st1[id * 2 + 1]);
}
long long get_ans1(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return inf;
  if (x <= l && r <= y) return st1[id];
  long long mid = (l + r) / 2;
  return min(get_ans1(x, y, id * 2, l, mid),
             get_ans1(x, y, id * 2 + 1, mid, r));
}
void build2(long long id = 1, long long l = 0, long long r = n) {
  if (l + 1 == r) {
    st2[id] = a[l];
    return;
  }
  long long mid = (l + r) / 2;
  build2(id * 2, l, mid);
  build2(id * 2 + 1, mid, r);
  st2[id] = min(st2[id * 2], st2[id * 2 + 1]);
}
long long get_ans2(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return inf;
  if (x <= l && r <= y) return st2[id];
  long long mid = (l + r) / 2;
  return min(get_ans2(x, y, id * 2, l, mid),
             get_ans2(x, y, id * 2 + 1, mid, r));
}
void build3(long long id = 1, long long l = 0, long long r = n) {
  if (l + 1 == r) {
    st3[id] = a[l];
    return;
  }
  long long mid = (l + r) / 2;
  build3(id * 2, l, mid);
  build3(id * 2 + 1, mid, r);
  st3[id] = max(st3[id * 2], st3[id * 2 + 1]);
}
long long get_ans3(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return -inf;
  if (x <= l && r <= y) return st3[id];
  long long mid = (l + r) / 2;
  return max(get_ans3(x, y, id * 2, l, mid),
             get_ans3(x, y, id * 2 + 1, mid, r));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fill(st1, st1 + mxsg, inf);
  cin >> n >> s >> l;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  build2();
  build3();
  long long p = 0;
  for (long long i = 0; i < n; i++) {
    while (p < i && abs(get_ans2(p, i + 1) - get_ans3(p, i + 1)) > s) p++;
    if (i < l - 1) {
      dp[i] = inf;
      modify1(i, inf);
      continue;
    }
    long long g = i - p + 1;
    if (g < l) {
      dp[i] = inf;
      modify1(i, inf);
      continue;
    }
    if (p == 0) {
      dp[i] = 1;
      modify1(i, 1);
      continue;
    }
    dp[i] = 1 + get_ans1(p - 1, i - l + 1);
    dp[i] = min(dp[i], inf);
    modify1(i, dp[i]);
  }
  cout << (dp[n - 1] >= inf ? -1 : dp[n - 1]) << endl;
  return 0;
}

### Prompt

Please formulate 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 maxx = 1e5 + 20, mxsg = 2e6 + 2, inf = 3e12 + 6;
long long st1[mxsg], st2[mxsg], st3[mxsg];
long long n, s, l, a[maxx], t = 0, dp[maxx];
void modify1(long long x, long long k, long long id = 1, long long l = 0,
             long long r = n) {
  if (l + 1 == r) {
    st1[id] = k;
    return;
  }
  long long mid = (l + r) / 2;
  if (x < mid)
    modify1(x, k, id * 2, l, mid);
  else
    modify1(x, k, id * 2 + 1, mid, r);
  st1[id] = min(st1[id * 2], st1[id * 2 + 1]);
}
long long get_ans1(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return inf;
  if (x <= l && r <= y) return st1[id];
  long long mid = (l + r) / 2;
  return min(get_ans1(x, y, id * 2, l, mid),
             get_ans1(x, y, id * 2 + 1, mid, r));
}
void build2(long long id = 1, long long l = 0, long long r = n) {
  if (l + 1 == r) {
    st2[id] = a[l];
    return;
  }
  long long mid = (l + r) / 2;
  build2(id * 2, l, mid);
  build2(id * 2 + 1, mid, r);
  st2[id] = min(st2[id * 2], st2[id * 2 + 1]);
}
long long get_ans2(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return inf;
  if (x <= l && r <= y) return st2[id];
  long long mid = (l + r) / 2;
  return min(get_ans2(x, y, id * 2, l, mid),
             get_ans2(x, y, id * 2 + 1, mid, r));
}
void build3(long long id = 1, long long l = 0, long long r = n) {
  if (l + 1 == r) {
    st3[id] = a[l];
    return;
  }
  long long mid = (l + r) / 2;
  build3(id * 2, l, mid);
  build3(id * 2 + 1, mid, r);
  st3[id] = max(st3[id * 2], st3[id * 2 + 1]);
}
long long get_ans3(long long x, long long y, long long id = 1, long long l = 0,
                   long long r = n) {
  if (x >= r || l >= y) return -inf;
  if (x <= l && r <= y) return st3[id];
  long long mid = (l + r) / 2;
  return max(get_ans3(x, y, id * 2, l, mid),
             get_ans3(x, y, id * 2 + 1, mid, r));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fill(st1, st1 + mxsg, inf);
  cin >> n >> s >> l;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  build2();
  build3();
  long long p = 0;
  for (long long i = 0; i < n; i++) {
    while (p < i && abs(get_ans2(p, i + 1) - get_ans3(p, i + 1)) > s) p++;
    if (i < l - 1) {
      dp[i] = inf;
      modify1(i, inf);
      continue;
    }
    long long g = i - p + 1;
    if (g < l) {
      dp[i] = inf;
      modify1(i, inf);
      continue;
    }
    if (p == 0) {
      dp[i] = 1;
      modify1(i, 1);
      continue;
    }
    dp[i] = 1 + get_ans1(p - 1, i - l + 1);
    dp[i] = min(dp[i], inf);
    modify1(i, dp[i]);
  }
  cout << (dp[n - 1] >= inf ? -1 : dp[n - 1]) << endl;
  return 0;
}

```