#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double E = exp(1);
int x[] = {0, 0, -1, 1};
int y[] = {-1, 1, 0, 0};
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
inline T sqr(T n) {
  return n * n;
}
inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }
template <typename T>
inline T pmod(T n, T m) {
  return ((n % m) + m) % m;
}
template <typename T>
T power(T n, int p) {
  return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template <typename T>
T bigmod(T n, int p, T m) {
  return (p == 0)
             ? (T)(1)
             : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %
                   m;
}
int ara[100005];
pair<int, int> tree[100005 * 4];
int dp[100005];
int pre[100005];
int cnt = 0;
int n, s, l;
void build(int node, int beg, int end) {
  if (beg == end) {
    tree[node].first = ara[beg];
    tree[node].second = ara[beg];
    return;
  }
  int mid = (beg + end) >> 1;
  int left = node * 2;
  int right = left + 1;
  build(left, beg, mid);
  build(right, mid + 1, end);
  tree[node].first = min(tree[left].first, tree[right].first);
  tree[node].second = max(tree[left].second, tree[right].second);
}
pair<int, int> query(int node, int beg, int end, int i, int j) {
  if (end < i || beg > j) return make_pair((1 << 30), -(1 << 30));
  if (beg >= i && end <= j) return tree[node];
  int mid = (beg + end) >> 1;
  int left = node * 2;
  int right = node * 2 + 1;
  pair<int, int> p1 = query(left, beg, mid, i, j);
  pair<int, int> p2 = query(right, mid + 1, end, i, j);
  return make_pair(min(p1.first, p2.first), max(p1.second, p2.second));
}
int bisection(int low, int high) {
  const int right = high;
  while (low <= high) {
    int mid = (low + high) / 2;
    pair<int, int> res = query(1, 1, n, mid, right);
    if (res.second - res.first <= s) {
      high = mid - 1;
    } else
      low = mid + 1;
  }
  return high;
}
int main() {
  scanf("%d %d %d", &n, &s, &l);
  for (int i = 1; i <= n; ++i) scanf("%d", &ara[i]);
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  cnt = 0;
  build(1, 1, n);
  for (int i = l; i <= n; i++) {
    int idx = lower_bound(pre, pre + cnt + 1, bisection(1, i)) - pre;
    if (idx <= cnt && (i - pre[idx]) >= l) {
      dp[i] = dp[pre[idx]] + 1;
      pre[++cnt] = i;
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}

### Prompt

Please create a solution in cpp 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 double PI = 2.0 * acos(0.0);
const double E = exp(1);
int x[] = {0, 0, -1, 1};
int y[] = {-1, 1, 0, 0};
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
inline T sqr(T n) {
  return n * n;
}
inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }
template <typename T>
inline T pmod(T n, T m) {
  return ((n % m) + m) % m;
}
template <typename T>
T power(T n, int p) {
  return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template <typename T>
T bigmod(T n, int p, T m) {
  return (p == 0)
             ? (T)(1)
             : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %
                   m;
}
int ara[100005];
pair<int, int> tree[100005 * 4];
int dp[100005];
int pre[100005];
int cnt = 0;
int n, s, l;
void build(int node, int beg, int end) {
  if (beg == end) {
    tree[node].first = ara[beg];
    tree[node].second = ara[beg];
    return;
  }
  int mid = (beg + end) >> 1;
  int left = node * 2;
  int right = left + 1;
  build(left, beg, mid);
  build(right, mid + 1, end);
  tree[node].first = min(tree[left].first, tree[right].first);
  tree[node].second = max(tree[left].second, tree[right].second);
}
pair<int, int> query(int node, int beg, int end, int i, int j) {
  if (end < i || beg > j) return make_pair((1 << 30), -(1 << 30));
  if (beg >= i && end <= j) return tree[node];
  int mid = (beg + end) >> 1;
  int left = node * 2;
  int right = node * 2 + 1;
  pair<int, int> p1 = query(left, beg, mid, i, j);
  pair<int, int> p2 = query(right, mid + 1, end, i, j);
  return make_pair(min(p1.first, p2.first), max(p1.second, p2.second));
}
int bisection(int low, int high) {
  const int right = high;
  while (low <= high) {
    int mid = (low + high) / 2;
    pair<int, int> res = query(1, 1, n, mid, right);
    if (res.second - res.first <= s) {
      high = mid - 1;
    } else
      low = mid + 1;
  }
  return high;
}
int main() {
  scanf("%d %d %d", &n, &s, &l);
  for (int i = 1; i <= n; ++i) scanf("%d", &ara[i]);
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  cnt = 0;
  build(1, 1, n);
  for (int i = l; i <= n; i++) {
    int idx = lower_bound(pre, pre + cnt + 1, bisection(1, i)) - pre;
    if (idx <= cnt && (i - pre[idx]) >= l) {
      dp[i] = dp[pre[idx]] + 1;
      pre[++cnt] = i;
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}

```