#include <bits/stdc++.h>
using namespace std;
int dp[100010];
long long val[100010];
int n, s;
struct Tree {
  int l, r;
  int Max, Min;
  int DP;
} tree[100010 * 4];
void Build(int l, int r, int ss) {
  tree[ss].l = l;
  tree[ss].r = r;
  tree[ss].DP = 1000000000;
  if (l == r) {
    tree[ss].Max = tree[ss].Min = val[l];
    return;
  }
  int mid = l + r >> 1;
  Build(l, mid, ss << 1);
  Build(mid + 1, r, ss << 1 | 1);
  tree[ss].Max = max(tree[ss << 1].Max, tree[ss << 1 | 1].Max);
  tree[ss].Min = min(tree[ss << 1].Min, tree[ss << 1 | 1].Min);
}
int Find(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].DP;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find(l, r, ss << 1);
  } else if (l > mid) {
    return Find(l, r, ss << 1 | 1);
  } else {
    return min(Find(l, mid, ss << 1), Find(mid + 1, r, ss << 1 | 1));
  }
}
void Update(int pos, int x, int ss) {
  if (pos == tree[ss].l && tree[ss].l == tree[ss].r) {
    tree[ss].DP = x;
    return;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (pos <= mid) {
    Update(pos, x, ss << 1);
  } else if (pos > mid) {
    Update(pos, x, ss << 1 | 1);
  }
  tree[ss].DP = min(tree[ss << 1].DP, tree[ss << 1 | 1].DP);
}
int Find_Max(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].Max;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find_Max(l, r, ss << 1);
  } else if (l > mid) {
    return Find_Max(l, r, ss << 1 | 1);
  } else {
    return max(Find_Max(l, mid, ss << 1), Find_Max(mid + 1, r, ss << 1 | 1));
  }
}
int Find_Min(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].Min;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find_Min(l, r, ss << 1);
  } else if (l > mid) {
    return Find_Min(l, r, ss << 1 | 1);
  } else {
    return min(Find_Min(l, mid, ss << 1), Find_Min(mid + 1, r, ss << 1 | 1));
  }
}
bool Judge(int k, int i) {
  int Max, Min;
  Max = Find_Max(k, i, 1);
  Min = Find_Min(k, i, 1);
  return Max - Min <= s;
}
int main() {
  int dif;
  while (scanf("%d%d%d", &n, &s, &dif) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &val[i]);
    }
    Build(1, n, 1);
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    Update(1, 0, 1);
    for (int i = 1; i <= n; i++) {
      int l = 1, r = (i - dif + 1), mid;
      if (l > r || !Judge(r, i)) {
        continue;
      }
      while (l < r) {
        mid = (l + r) >> 1;
        if (Judge(mid, i)) {
          r = mid;
        } else {
          l = mid + 1;
        }
      }
      dp[i] = Find(r, i - dif + 1, 1) + 1;
      if (i != n) {
        Update(i + 1, dp[i], 1);
      }
    }
    if (dp[n] > n) {
      puts("-1");
    } else {
      printf("%d\n", dp[n]);
    }
  }
  return 0;
}

### Prompt

Your challenge is to write 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;
int dp[100010];
long long val[100010];
int n, s;
struct Tree {
  int l, r;
  int Max, Min;
  int DP;
} tree[100010 * 4];
void Build(int l, int r, int ss) {
  tree[ss].l = l;
  tree[ss].r = r;
  tree[ss].DP = 1000000000;
  if (l == r) {
    tree[ss].Max = tree[ss].Min = val[l];
    return;
  }
  int mid = l + r >> 1;
  Build(l, mid, ss << 1);
  Build(mid + 1, r, ss << 1 | 1);
  tree[ss].Max = max(tree[ss << 1].Max, tree[ss << 1 | 1].Max);
  tree[ss].Min = min(tree[ss << 1].Min, tree[ss << 1 | 1].Min);
}
int Find(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].DP;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find(l, r, ss << 1);
  } else if (l > mid) {
    return Find(l, r, ss << 1 | 1);
  } else {
    return min(Find(l, mid, ss << 1), Find(mid + 1, r, ss << 1 | 1));
  }
}
void Update(int pos, int x, int ss) {
  if (pos == tree[ss].l && tree[ss].l == tree[ss].r) {
    tree[ss].DP = x;
    return;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (pos <= mid) {
    Update(pos, x, ss << 1);
  } else if (pos > mid) {
    Update(pos, x, ss << 1 | 1);
  }
  tree[ss].DP = min(tree[ss << 1].DP, tree[ss << 1 | 1].DP);
}
int Find_Max(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].Max;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find_Max(l, r, ss << 1);
  } else if (l > mid) {
    return Find_Max(l, r, ss << 1 | 1);
  } else {
    return max(Find_Max(l, mid, ss << 1), Find_Max(mid + 1, r, ss << 1 | 1));
  }
}
int Find_Min(int l, int r, int ss) {
  if (l == tree[ss].l && r == tree[ss].r) {
    return tree[ss].Min;
  }
  int mid = (tree[ss].l + tree[ss].r) >> 1;
  if (r <= mid) {
    return Find_Min(l, r, ss << 1);
  } else if (l > mid) {
    return Find_Min(l, r, ss << 1 | 1);
  } else {
    return min(Find_Min(l, mid, ss << 1), Find_Min(mid + 1, r, ss << 1 | 1));
  }
}
bool Judge(int k, int i) {
  int Max, Min;
  Max = Find_Max(k, i, 1);
  Min = Find_Min(k, i, 1);
  return Max - Min <= s;
}
int main() {
  int dif;
  while (scanf("%d%d%d", &n, &s, &dif) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &val[i]);
    }
    Build(1, n, 1);
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    Update(1, 0, 1);
    for (int i = 1; i <= n; i++) {
      int l = 1, r = (i - dif + 1), mid;
      if (l > r || !Judge(r, i)) {
        continue;
      }
      while (l < r) {
        mid = (l + r) >> 1;
        if (Judge(mid, i)) {
          r = mid;
        } else {
          l = mid + 1;
        }
      }
      dp[i] = Find(r, i - dif + 1, 1) + 1;
      if (i != n) {
        Update(i + 1, dp[i], 1);
      }
    }
    if (dp[n] > n) {
      puts("-1");
    } else {
      printf("%d\n", dp[n]);
    }
  }
  return 0;
}

```