#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
template <typename T>
T fac(T a) {
  return a ? a * fac(a - 1) : 1;
}
template <typename T>
T power(T a, int p) {
  return !p ? 1 : (p & 1 ? a * power(a, p - 1) : power(a * a, p >> 1));
}
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 b / gcd(a, b) * a;
}
template <typename T>
T next() {
  T _;
  cin >> _;
  return _;
}
template <>
int next<int>() {
  int _;
  scanf("%d", &_);
  return _;
}
template <>
double next<double>() {
  double _;
  scanf("%lf", &_);
  return _;
}
template <>
long long next<long long>() {
  long long _;
  scanf("%I64d", &_);
  return _;
}
template <typename E>
vector<E> next(int n) {
  vector<E> res(n);
  for (int i = 0; i < n; i++) res[i] = next<E>();
  return res;
}
template <class C, class E>
int count(const C &c, const E &e) {
  return count(c.begin(), c.end(), e);
}
template <class E>
bool has(const vector<E> &c, const E &e) {
  return find(c.begin(), c.end(), e) != c.end();
}
template <class E>
int find(const vector<E> &c, const E &e) {
  return find(c.begin(), c.end(), e) - c.begin();
}
template <class E>
bool binary_has(const vector<E> &c, const E &e) {
  return binary_search(c.begin(), c.end(), e);
}
template <class E>
int binary_find(const vector<E> &c, const E &e) {
  return lower_bound(c.begin(), c.end(), e) - c.begin();
}
template <typename T>
T dist2(T i1, T j1, T i2, T j2) {
  return (i1 - i2) * (i1 - i2) + (j1 - j2) * (j1 - j2);
}
bool ok(int i, int j, int n, int m) {
  return 0 <= i && i < n && 0 <= j && j < m;
}
const double EPS = 1e-9;
bool LE(double a, double b) { return b - a > -EPS; }
bool BE(double a, double b) { return a - b > -EPS; }
bool EQ(double a, double b) { return fabs(a - b) < EPS; }
bool LESS(double a, double b) { return b - a > EPS; }
bool BIGG(double a, double b) { return a - b > EPS; }
template <int N, typename T>
class lug {
 public:
  T at[N];
};
const int N = 1 << 17;
int tree[2 * N];
void setMin(int i, int val, int node = 1, int l = 0, int r = N - 1) {
  if (l <= i && i <= r) {
    if (l == r) {
      tree[node] = val;
    } else {
      int mid = (l + r) / 2;
      setMin(i, val, node * 2, l, mid);
      setMin(i, val, node * 2 + 1, mid + 1, r);
      tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
    }
  }
}
int getMin(int from, int to, int node = 1, int l = 0, int r = N - 1) {
  if (to < l || r < from) return 1 << 20;
  if (from <= l && r <= to) return tree[node];
  int mid = (l + r) / 2;
  return min(getMin(from, to, node * 2, l, mid),
             getMin(from, to, node * 2 + 1, mid + 1, r));
}
int main() {
  int n = next<int>();
  int s = next<int>();
  int l = next<int>();
  vector<int> v(n);
  for (int i = 0; i < n; i++) v[i] = next<int>();
  map<int, int> mp;
  vector<int> right(n, -1);
  int i = 0, j = -1;
  while (i < n) {
    if (j + 1 < n && (mp.empty() || max(mp.rbegin()->first, v[j + 1]) -
                                            min(mp.begin()->first, v[j + 1]) <=
                                        s)) {
      mp[v[j + 1]]++;
      j++;
    } else {
      right[i] = j;
      mp[v[i]]--;
      if (mp[v[i]] == 0) mp.erase(v[i]);
      i++;
    }
  }
  for (int i = 0; i < n; i++) setMin(i, 1 << 20);
  setMin(n, 0);
  for (int i = n - 1; i >= 0; i--) {
    if (right[i] + 1 >= i + l) {
      int r = 1 + getMin(i + l, right[i] + 1);
      setMin(i, r);
    }
  }
  if (getMin(0, 0) >= (1 << 20))
    puts("-1");
  else
    cout << getMin(0, 0) << endl;
  return 0;
}

### Prompt

Please provide a cpp coded solution 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;
#pragma comment(linker, "/STACK:16777216")
template <typename T>
T fac(T a) {
  return a ? a * fac(a - 1) : 1;
}
template <typename T>
T power(T a, int p) {
  return !p ? 1 : (p & 1 ? a * power(a, p - 1) : power(a * a, p >> 1));
}
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 b / gcd(a, b) * a;
}
template <typename T>
T next() {
  T _;
  cin >> _;
  return _;
}
template <>
int next<int>() {
  int _;
  scanf("%d", &_);
  return _;
}
template <>
double next<double>() {
  double _;
  scanf("%lf", &_);
  return _;
}
template <>
long long next<long long>() {
  long long _;
  scanf("%I64d", &_);
  return _;
}
template <typename E>
vector<E> next(int n) {
  vector<E> res(n);
  for (int i = 0; i < n; i++) res[i] = next<E>();
  return res;
}
template <class C, class E>
int count(const C &c, const E &e) {
  return count(c.begin(), c.end(), e);
}
template <class E>
bool has(const vector<E> &c, const E &e) {
  return find(c.begin(), c.end(), e) != c.end();
}
template <class E>
int find(const vector<E> &c, const E &e) {
  return find(c.begin(), c.end(), e) - c.begin();
}
template <class E>
bool binary_has(const vector<E> &c, const E &e) {
  return binary_search(c.begin(), c.end(), e);
}
template <class E>
int binary_find(const vector<E> &c, const E &e) {
  return lower_bound(c.begin(), c.end(), e) - c.begin();
}
template <typename T>
T dist2(T i1, T j1, T i2, T j2) {
  return (i1 - i2) * (i1 - i2) + (j1 - j2) * (j1 - j2);
}
bool ok(int i, int j, int n, int m) {
  return 0 <= i && i < n && 0 <= j && j < m;
}
const double EPS = 1e-9;
bool LE(double a, double b) { return b - a > -EPS; }
bool BE(double a, double b) { return a - b > -EPS; }
bool EQ(double a, double b) { return fabs(a - b) < EPS; }
bool LESS(double a, double b) { return b - a > EPS; }
bool BIGG(double a, double b) { return a - b > EPS; }
template <int N, typename T>
class lug {
 public:
  T at[N];
};
const int N = 1 << 17;
int tree[2 * N];
void setMin(int i, int val, int node = 1, int l = 0, int r = N - 1) {
  if (l <= i && i <= r) {
    if (l == r) {
      tree[node] = val;
    } else {
      int mid = (l + r) / 2;
      setMin(i, val, node * 2, l, mid);
      setMin(i, val, node * 2 + 1, mid + 1, r);
      tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
    }
  }
}
int getMin(int from, int to, int node = 1, int l = 0, int r = N - 1) {
  if (to < l || r < from) return 1 << 20;
  if (from <= l && r <= to) return tree[node];
  int mid = (l + r) / 2;
  return min(getMin(from, to, node * 2, l, mid),
             getMin(from, to, node * 2 + 1, mid + 1, r));
}
int main() {
  int n = next<int>();
  int s = next<int>();
  int l = next<int>();
  vector<int> v(n);
  for (int i = 0; i < n; i++) v[i] = next<int>();
  map<int, int> mp;
  vector<int> right(n, -1);
  int i = 0, j = -1;
  while (i < n) {
    if (j + 1 < n && (mp.empty() || max(mp.rbegin()->first, v[j + 1]) -
                                            min(mp.begin()->first, v[j + 1]) <=
                                        s)) {
      mp[v[j + 1]]++;
      j++;
    } else {
      right[i] = j;
      mp[v[i]]--;
      if (mp[v[i]] == 0) mp.erase(v[i]);
      i++;
    }
  }
  for (int i = 0; i < n; i++) setMin(i, 1 << 20);
  setMin(n, 0);
  for (int i = n - 1; i >= 0; i--) {
    if (right[i] + 1 >= i + l) {
      int r = 1 + getMin(i + l, right[i] + 1);
      setMin(i, r);
    }
  }
  if (getMin(0, 0) >= (1 << 20))
    puts("-1");
  else
    cout << getMin(0, 0) << endl;
  return 0;
}

```