#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int kMaxN = 1e5 + 7;
constexpr int kLog = 20;
constexpr int inf = 1e8;
int mins[kMaxN][kLog];
int maxs[kMaxN][kLog];
int ilog[kMaxN];
int get_min(int l, int r) {
  if (l == r) {
    return mins[l][0];
  }
  int dlog = ilog[r - l];
  return min(mins[l][dlog], mins[r - (1 << dlog) + 1][dlog]);
}
int get_max(int l, int r) {
  if (l == r) {
    return maxs[l][0];
  }
  int dlog = ilog[r - l];
  return max(maxs[l][dlog], maxs[r - (1 << dlog) + 1][dlog]);
}
struct SegTree {
  int sz;
  vector<int> ms;
  SegTree(int n) {
    sz = 1;
    while (sz < n) {
      sz *= 2;
    }
    ms.resize(2 * sz, inf);
  }
  void update(int idx, int val) {
    idx += sz;
    ms[idx] = val;
    idx /= 2;
    while (idx) {
      int l = 2 * idx, r = l + 1;
      ms[idx] = min(ms[l], ms[r]);
      idx /= 2;
    }
  }
  int find(int l, int r) { return _find(l, r, 0, sz - 1, 1); }

 private:
  int _find(int l, int r, int L, int R, int idx) {
    if (l == L && r == R) {
      return ms[idx];
    }
    int M = (L + R) / 2;
    if (r <= M) {
      return _find(l, r, L, M, 2 * idx);
    } else if (l > M) {
      return _find(l, r, M + 1, R, 2 * idx + 1);
    } else {
      return min(_find(l, M, L, M, 2 * idx),
                 _find(M + 1, r, M + 1, R, 2 * idx + 1));
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, s, l;
  cin >> n >> s >> l;
  if (l > n) {
    cout << "-1\n";
    return 0;
  }
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mins[i][0] = maxs[i][0] = a[i];
  }
  for (int i = 1; i < kLog; ++i) {
    for (int j = (1 << i); j < (2 << i) && j < kMaxN; ++j) {
      ilog[j] = i;
    }
  }
  for (int i = 1, d = 1; i < kLog; ++i, d *= 2) {
    for (int j = 0; j + d < n; ++j) {
      mins[j][i] = min(mins[j][i - 1], mins[j + d][i - 1]);
      maxs[j][i] = max(maxs[j][i - 1], maxs[j + d][i - 1]);
    }
  }
  auto get_best = [&](int i) {
    int l = 0, r = i, best = i;
    while (l <= r) {
      int m = (l + r) / 2;
      if (get_max(m, i) - get_min(m, i) <= s) {
        best = m;
        r = m - 1;
      } else {
        l = m + 1;
      }
    }
    return best;
  };
  SegTree seg(n);
  for (int i = l - 1; i < n; ++i) {
    int first = get_best(i);
    if (i - first + 1 < l) {
      continue;
    }
    int val = inf;
    if (first == 0) {
      val = 1;
    } else {
      int left = first - 1, right = i - l;
      if (left <= right) {
        val = seg.find(left, right) + 1;
      }
    }
    seg.update(i, val);
  }
  int res = seg.find(n - 1, n - 1);
  cout << (res >= inf ? -1 : res) << '\n';
  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;
using ll = long long;
constexpr int kMaxN = 1e5 + 7;
constexpr int kLog = 20;
constexpr int inf = 1e8;
int mins[kMaxN][kLog];
int maxs[kMaxN][kLog];
int ilog[kMaxN];
int get_min(int l, int r) {
  if (l == r) {
    return mins[l][0];
  }
  int dlog = ilog[r - l];
  return min(mins[l][dlog], mins[r - (1 << dlog) + 1][dlog]);
}
int get_max(int l, int r) {
  if (l == r) {
    return maxs[l][0];
  }
  int dlog = ilog[r - l];
  return max(maxs[l][dlog], maxs[r - (1 << dlog) + 1][dlog]);
}
struct SegTree {
  int sz;
  vector<int> ms;
  SegTree(int n) {
    sz = 1;
    while (sz < n) {
      sz *= 2;
    }
    ms.resize(2 * sz, inf);
  }
  void update(int idx, int val) {
    idx += sz;
    ms[idx] = val;
    idx /= 2;
    while (idx) {
      int l = 2 * idx, r = l + 1;
      ms[idx] = min(ms[l], ms[r]);
      idx /= 2;
    }
  }
  int find(int l, int r) { return _find(l, r, 0, sz - 1, 1); }

 private:
  int _find(int l, int r, int L, int R, int idx) {
    if (l == L && r == R) {
      return ms[idx];
    }
    int M = (L + R) / 2;
    if (r <= M) {
      return _find(l, r, L, M, 2 * idx);
    } else if (l > M) {
      return _find(l, r, M + 1, R, 2 * idx + 1);
    } else {
      return min(_find(l, M, L, M, 2 * idx),
                 _find(M + 1, r, M + 1, R, 2 * idx + 1));
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, s, l;
  cin >> n >> s >> l;
  if (l > n) {
    cout << "-1\n";
    return 0;
  }
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mins[i][0] = maxs[i][0] = a[i];
  }
  for (int i = 1; i < kLog; ++i) {
    for (int j = (1 << i); j < (2 << i) && j < kMaxN; ++j) {
      ilog[j] = i;
    }
  }
  for (int i = 1, d = 1; i < kLog; ++i, d *= 2) {
    for (int j = 0; j + d < n; ++j) {
      mins[j][i] = min(mins[j][i - 1], mins[j + d][i - 1]);
      maxs[j][i] = max(maxs[j][i - 1], maxs[j + d][i - 1]);
    }
  }
  auto get_best = [&](int i) {
    int l = 0, r = i, best = i;
    while (l <= r) {
      int m = (l + r) / 2;
      if (get_max(m, i) - get_min(m, i) <= s) {
        best = m;
        r = m - 1;
      } else {
        l = m + 1;
      }
    }
    return best;
  };
  SegTree seg(n);
  for (int i = l - 1; i < n; ++i) {
    int first = get_best(i);
    if (i - first + 1 < l) {
      continue;
    }
    int val = inf;
    if (first == 0) {
      val = 1;
    } else {
      int left = first - 1, right = i - l;
      if (left <= right) {
        val = seg.find(left, right) + 1;
      }
    }
    seg.update(i, val);
  }
  int res = seg.find(n - 1, n - 1);
  cout << (res >= inf ? -1 : res) << '\n';
  return 0;
}

```