#include <bits/stdc++.h>
using namespace std;
long long int MOD(long long int a, long long int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int logg(long long int a) {
  long long int x = 0;
  while (a > 1) {
    x++;
    a /= 2;
  }
  return x;
}
vector<pair<int, int> > tree;
int n;
void build(int node, int l, int r, vector<int>& A) {
  if (l == r) {
    tree[node] = make_pair(A[l], A[l]);
    return;
  }
  int mid = (l + r) / 2;
  build(node * 2 + 1, l, mid, A);
  build(node * 2 + 2, mid + 1, r, A);
  tree[node].first = min(tree[node * 2 + 1].first, tree[node * 2 + 2].first);
  tree[node].second = max(tree[node * 2 + 1].second, tree[node * 2 + 2].second);
  return;
}
pair<int, int> query(int node, int l, int r, int start, int end) {
  if (l > end || start > r) {
    return make_pair(2000000001, -2000000001);
  }
  if (l >= start && r <= end) {
    return tree[node];
  }
  int mid = (l + r) / 2;
  pair<int, int> a = query(node * 2 + 1, l, mid, start, end);
  pair<int, int> b = query(node * 2 + 2, mid + 1, r, start, end);
  pair<int, int> c = make_pair(min(a.first, b.first), max(a.second, b.second));
  return c;
}
pair<int, int> func(int l, vector<int>& A, int r, int second) {
  int n = A.size();
  int beg = r + l - 1, last = n - 1, mid;
  if (beg >= n) return make_pair(n + 1, n + 1);
  pair<int, int> a = query(0, 0, n - 1, l, beg);
  if (a.second - a.first > second) {
    return make_pair(n + 1, n + 1);
  }
  a = query(0, 0, n - 1, l, last);
  if (a.second - a.first <= second) return make_pair(l + r - 1, last);
  last--;
  while (beg <= last) {
    mid = (beg + last) / 2;
    pair<int, int> b = query(0, 0, n - 1, l, mid);
    pair<int, int> c = query(0, 0, n - 1, l, mid + 1);
    if (b.second - b.first <= second && c.second - c.first > second)
      return make_pair(l + r - 1, mid);
    else if (b.second - b.first <= second)
      beg = mid + 1;
    else
      last = mid - 1;
  }
}
vector<int> tree1;
void update(int node, int l, int r, int i, int x) {
  if (l == r) {
    tree1[node] = x;
    return;
  }
  int mid = (l + r) / 2;
  if (i <= mid) {
    update(node * 2 + 1, l, mid, i, x);
  } else
    update(node * 2 + 2, mid + 1, r, i, x);
  tree1[node] = min(tree1[node * 2 + 1], tree1[node * 2 + 2]);
}
int query1(int node, int l, int r, int start, int end) {
  if (l > end || r < start) {
    return n + 1;
  }
  if (start <= l && r <= end) {
    return tree1[node];
  }
  int mid = (l + r) / 2;
  int p1 = query1(node * 2 + 1, l, mid, start, end);
  int p2 = query1(node * 2 + 2, mid + 1, r, start, end);
  return min(p1, p2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int second, l;
  cin >> n >> second >> l;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  tree.resize(4 * n + 5);
  build(0, 0, n - 1, A);
  vector<pair<int, int> > B(n);
  for (int i = 0; i < n; i++) {
    B[i] = func(i, A, l, second);
  }
  tree1.resize(4 * n + 5, n + 1);
  vector<int> C(n);
  for (int i = n - 1; i >= 0; i--) {
    if (B[i].first == n + 1) {
      C[i] = n + 1;
    } else if (B[i].second == n - 1) {
      C[i] = 1;
    } else {
      C[i] = 1 + query1(0, 0, n - 1, B[i].first + 1, B[i].second + 1);
    }
    update(0, 0, n - 1, i, C[i]);
  }
  if (C[0] > n) {
    cout << -1;
  } else
    cout << C[0];
}

### Prompt

In cpp, your task is to solve 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;
long long int MOD(long long int a, long long int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int logg(long long int a) {
  long long int x = 0;
  while (a > 1) {
    x++;
    a /= 2;
  }
  return x;
}
vector<pair<int, int> > tree;
int n;
void build(int node, int l, int r, vector<int>& A) {
  if (l == r) {
    tree[node] = make_pair(A[l], A[l]);
    return;
  }
  int mid = (l + r) / 2;
  build(node * 2 + 1, l, mid, A);
  build(node * 2 + 2, mid + 1, r, A);
  tree[node].first = min(tree[node * 2 + 1].first, tree[node * 2 + 2].first);
  tree[node].second = max(tree[node * 2 + 1].second, tree[node * 2 + 2].second);
  return;
}
pair<int, int> query(int node, int l, int r, int start, int end) {
  if (l > end || start > r) {
    return make_pair(2000000001, -2000000001);
  }
  if (l >= start && r <= end) {
    return tree[node];
  }
  int mid = (l + r) / 2;
  pair<int, int> a = query(node * 2 + 1, l, mid, start, end);
  pair<int, int> b = query(node * 2 + 2, mid + 1, r, start, end);
  pair<int, int> c = make_pair(min(a.first, b.first), max(a.second, b.second));
  return c;
}
pair<int, int> func(int l, vector<int>& A, int r, int second) {
  int n = A.size();
  int beg = r + l - 1, last = n - 1, mid;
  if (beg >= n) return make_pair(n + 1, n + 1);
  pair<int, int> a = query(0, 0, n - 1, l, beg);
  if (a.second - a.first > second) {
    return make_pair(n + 1, n + 1);
  }
  a = query(0, 0, n - 1, l, last);
  if (a.second - a.first <= second) return make_pair(l + r - 1, last);
  last--;
  while (beg <= last) {
    mid = (beg + last) / 2;
    pair<int, int> b = query(0, 0, n - 1, l, mid);
    pair<int, int> c = query(0, 0, n - 1, l, mid + 1);
    if (b.second - b.first <= second && c.second - c.first > second)
      return make_pair(l + r - 1, mid);
    else if (b.second - b.first <= second)
      beg = mid + 1;
    else
      last = mid - 1;
  }
}
vector<int> tree1;
void update(int node, int l, int r, int i, int x) {
  if (l == r) {
    tree1[node] = x;
    return;
  }
  int mid = (l + r) / 2;
  if (i <= mid) {
    update(node * 2 + 1, l, mid, i, x);
  } else
    update(node * 2 + 2, mid + 1, r, i, x);
  tree1[node] = min(tree1[node * 2 + 1], tree1[node * 2 + 2]);
}
int query1(int node, int l, int r, int start, int end) {
  if (l > end || r < start) {
    return n + 1;
  }
  if (start <= l && r <= end) {
    return tree1[node];
  }
  int mid = (l + r) / 2;
  int p1 = query1(node * 2 + 1, l, mid, start, end);
  int p2 = query1(node * 2 + 2, mid + 1, r, start, end);
  return min(p1, p2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int second, l;
  cin >> n >> second >> l;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  tree.resize(4 * n + 5);
  build(0, 0, n - 1, A);
  vector<pair<int, int> > B(n);
  for (int i = 0; i < n; i++) {
    B[i] = func(i, A, l, second);
  }
  tree1.resize(4 * n + 5, n + 1);
  vector<int> C(n);
  for (int i = n - 1; i >= 0; i--) {
    if (B[i].first == n + 1) {
      C[i] = n + 1;
    } else if (B[i].second == n - 1) {
      C[i] = 1;
    } else {
      C[i] = 1 + query1(0, 0, n - 1, B[i].first + 1, B[i].second + 1);
    }
    update(0, 0, n - 1, i, C[i]);
  }
  if (C[0] > n) {
    cout << -1;
  } else
    cout << C[0];
}

```