#include <bits/stdc++.h>
using namespace std;
vector<long long> a(100005), seg(4 * 100005);
void build(long long cur, long long st, long long end) {
  if (st == end) {
    seg[cur] = a[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build(2 * cur, st, mid);
  build(2 * cur + 1, mid + 1, end);
  seg[cur] = min(seg[2 * cur], seg[2 * cur + 1]);
}
long long query(long long cur, long long st, long long end, long long l,
                long long r) {
  if (st > end || st > r || end < l) return 1000000007;
  if (st >= l && end <= r) return seg[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query(2 * cur, st, mid, l, r);
  long long ans2 = query(2 * cur + 1, mid + 1, end, l, r);
  return min(ans1, ans2);
}
vector<long long> seg1(4 * 100005);
void build1(long long cur, long long st, long long end) {
  if (st == end) {
    seg1[cur] = a[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build1(2 * cur, st, mid);
  build1(2 * cur + 1, mid + 1, end);
  seg1[cur] = max(seg1[2 * cur], seg1[2 * cur + 1]);
}
long long query1(long long cur, long long st, long long end, long long l,
                 long long r) {
  if (st > end || st > r || end < l) return (-1000000007);
  if (st >= l && end <= r) return seg1[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query1(2 * cur, st, mid, l, r);
  long long ans2 = query1(2 * cur + 1, mid + 1, end, l, r);
  return max(ans1, ans2);
}
long long n, q;
vector<long long> ans(100005), seg2(4 * 100005), lazy(4 * 100005, 1000000007);
void build2(long long cur, long long st, long long end) {
  if (st == end) {
    seg2[cur] = ans[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build2(2 * cur, st, mid);
  build2(2 * cur + 1, mid + 1, end);
  seg2[cur] = min(seg2[2 * cur], seg2[2 * cur + 1]);
}
void updaterange(long long cur, long long st, long long end, long long l,
                 long long r, long long val) {
  if (lazy[cur] != 1000000007) {
    seg2[cur] = min(lazy[cur], seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(lazy[cur], lazy[2 * cur]);
      lazy[2 * cur + 1] = min(lazy[cur], lazy[2 * cur + 1]);
    }
    lazy[cur] = 1000000007;
  }
  if (st > end || st > r || end < l) return;
  if (l <= st && end <= r) {
    seg2[cur] = min(val, seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(val, lazy[2 * cur]);
      lazy[2 * cur + 1] = min(val, lazy[2 * cur + 1]);
    }
    return;
  }
  long long mid = (st + end) >> 1;
  updaterange(2 * cur, st, mid, l, r, val);
  updaterange(2 * cur + 1, mid + 1, end, l, r, val);
  seg2[cur] = min(seg2[2 * cur], seg2[2 * cur + 1]);
}
long long query2(long long cur, long long st, long long end, long long l,
                 long long r) {
  if (st > end || st > r || end < l) return 1000000007;
  if (lazy[cur] != 0) {
    seg2[cur] = min(lazy[cur], seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(lazy[cur], lazy[2 * cur]);
      lazy[2 * cur + 1] = min(lazy[cur], lazy[2 * cur + 1]);
    }
    lazy[cur] = 1000000007;
  }
  if (st >= l && end <= r) return seg2[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query2(2 * cur, st, mid, l, r);
  long long ans2 = query2(2 * cur + 1, mid + 1, end, l, r);
  return min(ans1, ans2);
}
int main() {
  int TESTS = 1;
  while (TESTS--) {
    long long n, s, l;
    cin >> n >> s >> l;
    for (long long i = 0; i < n; i++) cin >> a[i];
    build(1, 0, n - 1);
    build1(1, 0, n - 1);
    for (long long i = 1; i < n + 1; i++) ans[i] = 1000000007;
    ans[0] = 0;
    build2(1, 0, n);
    int j = 0;
    for (long long i = 0; i < n - l + 1; i++) {
      long long t = query2(1, 0, n, i, i);
      while ((j < n) &&
             (query1(1, 0, n - 1, i, j) - query(1, 0, n - 1, i, j) <= s))
        j++;
      if (i + l <= j) updaterange(1, 0, n, i + l, j, t + 1);
    }
    int t = query2(1, 0, n, n, n);
    if (t == 1000000007)
      cout << -1 << '\n';
    else
      cout << t << '\n';
  }
  return 0;
}

### Prompt

Generate 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;
vector<long long> a(100005), seg(4 * 100005);
void build(long long cur, long long st, long long end) {
  if (st == end) {
    seg[cur] = a[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build(2 * cur, st, mid);
  build(2 * cur + 1, mid + 1, end);
  seg[cur] = min(seg[2 * cur], seg[2 * cur + 1]);
}
long long query(long long cur, long long st, long long end, long long l,
                long long r) {
  if (st > end || st > r || end < l) return 1000000007;
  if (st >= l && end <= r) return seg[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query(2 * cur, st, mid, l, r);
  long long ans2 = query(2 * cur + 1, mid + 1, end, l, r);
  return min(ans1, ans2);
}
vector<long long> seg1(4 * 100005);
void build1(long long cur, long long st, long long end) {
  if (st == end) {
    seg1[cur] = a[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build1(2 * cur, st, mid);
  build1(2 * cur + 1, mid + 1, end);
  seg1[cur] = max(seg1[2 * cur], seg1[2 * cur + 1]);
}
long long query1(long long cur, long long st, long long end, long long l,
                 long long r) {
  if (st > end || st > r || end < l) return (-1000000007);
  if (st >= l && end <= r) return seg1[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query1(2 * cur, st, mid, l, r);
  long long ans2 = query1(2 * cur + 1, mid + 1, end, l, r);
  return max(ans1, ans2);
}
long long n, q;
vector<long long> ans(100005), seg2(4 * 100005), lazy(4 * 100005, 1000000007);
void build2(long long cur, long long st, long long end) {
  if (st == end) {
    seg2[cur] = ans[st];
    return;
  }
  long long mid = (st + end) >> 1;
  build2(2 * cur, st, mid);
  build2(2 * cur + 1, mid + 1, end);
  seg2[cur] = min(seg2[2 * cur], seg2[2 * cur + 1]);
}
void updaterange(long long cur, long long st, long long end, long long l,
                 long long r, long long val) {
  if (lazy[cur] != 1000000007) {
    seg2[cur] = min(lazy[cur], seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(lazy[cur], lazy[2 * cur]);
      lazy[2 * cur + 1] = min(lazy[cur], lazy[2 * cur + 1]);
    }
    lazy[cur] = 1000000007;
  }
  if (st > end || st > r || end < l) return;
  if (l <= st && end <= r) {
    seg2[cur] = min(val, seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(val, lazy[2 * cur]);
      lazy[2 * cur + 1] = min(val, lazy[2 * cur + 1]);
    }
    return;
  }
  long long mid = (st + end) >> 1;
  updaterange(2 * cur, st, mid, l, r, val);
  updaterange(2 * cur + 1, mid + 1, end, l, r, val);
  seg2[cur] = min(seg2[2 * cur], seg2[2 * cur + 1]);
}
long long query2(long long cur, long long st, long long end, long long l,
                 long long r) {
  if (st > end || st > r || end < l) return 1000000007;
  if (lazy[cur] != 0) {
    seg2[cur] = min(lazy[cur], seg2[cur]);
    if (st != end) {
      lazy[2 * cur] = min(lazy[cur], lazy[2 * cur]);
      lazy[2 * cur + 1] = min(lazy[cur], lazy[2 * cur + 1]);
    }
    lazy[cur] = 1000000007;
  }
  if (st >= l && end <= r) return seg2[cur];
  long long mid = (st + end) >> 1;
  long long ans1 = query2(2 * cur, st, mid, l, r);
  long long ans2 = query2(2 * cur + 1, mid + 1, end, l, r);
  return min(ans1, ans2);
}
int main() {
  int TESTS = 1;
  while (TESTS--) {
    long long n, s, l;
    cin >> n >> s >> l;
    for (long long i = 0; i < n; i++) cin >> a[i];
    build(1, 0, n - 1);
    build1(1, 0, n - 1);
    for (long long i = 1; i < n + 1; i++) ans[i] = 1000000007;
    ans[0] = 0;
    build2(1, 0, n);
    int j = 0;
    for (long long i = 0; i < n - l + 1; i++) {
      long long t = query2(1, 0, n, i, i);
      while ((j < n) &&
             (query1(1, 0, n - 1, i, j) - query(1, 0, n - 1, i, j) <= s))
        j++;
      if (i + l <= j) updaterange(1, 0, n, i + l, j, t + 1);
    }
    int t = query2(1, 0, n, n, n);
    if (t == 1000000007)
      cout << -1 << '\n';
    else
      cout << t << '\n';
  }
  return 0;
}

```