#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using vi = vector<int>;   using vpi = vector<pair<int, int>>;   using pi = pair<int, int>;   const int nax = 1e5 + 7;   const int mod = 1e9 + 7;   const int inf = numeric_limits<int>::max() - (int)9e6;   struct monotonic_queue {     queue<int> qu;     deque<int> mx, mn;     void push(int v) {       qu.push(v);       while (mx.size() && mx.back() < v) mx.pop_back();       mx.push_back(v);       while (mn.size() && mn.back() > v) mn.pop_back();       mn.push_back(v);     }     void pop() {       if (mx.front() == qu.front()) mx.pop_front();       if (mn.front() == qu.front()) mn.pop_front();       qu.pop();     }     int front() const { return qu.front(); }     int max() const { return mx.front(); }     int min() const { return mn.front(); }     int size() const { return qu.size(); }     bool empty() { return qu.empty(); }   };   int n;   void test() {     cin >> n;     int s, l;     cin >> s >> l;     vi v(n);     for (int i = 0; i < (int)n; i++) cin >> v[i];     monotonic_queue q;     vi g(n, n);     for (int i = n - 1, j = n - 1; i >= 0; i--) {       while (j >= 0 and (q.empty() or (((q.max() - q.min()) <= s)))) {         q.push(v[j--]);       }       g[i] = (((q.max() - q.min()) <= s) ? j : j + 1);       if (((int)(q).size())) q.pop();     }     while (((int)(q).size())) q.pop();     vi dp(n + 1, inf);     dp[0] = 0;     for (int i = l, j = 0; i <= n; i++) {       q.push(dp[i - l]);       while (((int)(q).size()) and j <= g[i - 1]) q.pop(), j++;       if (((int)(q).size())) dp[i] = q.min() + 1;     }     cout << (dp[n] >= inf ? -1 : dp[n]);   }   signed main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     int T = 1;     while (T--) {       test();       cout <<   n ;     }     return 0;   }   