#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include<numeric>
#include<functional>

using namespace std;
#define ll long long
#define ull unsigned long long
#define rrep(i,m,n) for(ll (i)=(ll)(m);(i)>=(ll)(n);(i)--)
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 62;
constexpr long double EPS = 1e-10;
template<typename T> using vector2 = vector<vector<T>>;
template<typename T> using vector3 = vector<vector2<T>>;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
string operator*(const string& s, int k) {
	if (k == 0) return "";
	string p = (s + s) * (k / 2);
	if (k % 2 == 1) p += s;
	return p;
}

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

struct Edge {//グラフ
	int to, rev; ll cap;
	Edge(int _to, ll _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph& G, int from, int to, ll cap, bool revFlag, ll revCap) {//最大フロー求める Ford-fulkerson
	G[from].push_back(Edge(to, cap, (ll)G[to].size() + (from == to)));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));//最小カットの場合逆辺は0にする
}

ll max_flow_dfs(Graph& G, ll v, ll t, ll f, vector<bool>& used)
{
	if (v == t)
		return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i) {
		Edge& e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			ll d = max_flow_dfs(G, e.to, t, min(f, e.cap), used);
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
//二分グラフの最大マッチングを求めたりも出来る　また二部グラフの最大独立集合は頂点数-最大マッチングのサイズ
ll max_flow(Graph& G, ll s, ll t)//O(V(V+E))
{
	ll flow = 0;
	for (;;) {
		vector<bool> used(G.size());
		REP(i, used.size())used[i] = false;
		ll f = max_flow_dfs(G, s, t, INF, used);
		if (f == 0) {
			return flow;
		}
		flow += f;
	}
}

void BellmanFord(Graph& G, ll s, Array& d, Array& negative) {//O(|E||V|)
	d.resize(G.size());
	negative.resize(G.size());
	REP(i, d.size())d[i] = INF;
	REP(i, d.size())negative[i] = false;
	d[s] = 0;
	REP(k, G.size() - 1) {
		REP(i, G.size()) {
			REP(j, G[i].size()) {
				if (d[i] != INF && d[G[i][j].to] > d[i] + G[i][j].cap) {
					d[G[i][j].to] = d[i] + G[i][j].cap;
				}
			}
		}
	}
	REP(k, G.size() - 1) {
		REP(i, G.size()) {
			REP(j, G[i].size()) {
				if (d[i] != INF && d[G[i][j].to] > d[i] + G[i][j].cap) {
					d[G[i][j].to] = d[i] + G[i][j].cap;
					negative[G[i][j].to] = true;
				}
				if (negative[i] == true)negative[G[i][j].to] = true;
			}
		}
	}
}
void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
	d.resize(G.size());
	REP(i, d.size())d[i] = INF;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(make_pair(0, s));
	while (!q.empty()) {
		P a = q.top();
		q.pop();
		if (d[a.second] < a.first)continue;
		REP(i, G[a.second].size()) {
			Edge e = G[a.second][i];
			if (d[e.to] > d[a.second] + e.cap) {
				d[e.to] = d[a.second] + e.cap;
				q.push(make_pair(d[e.to], e.to));
			}
		}
	}
}
void WarshallFloyd(Graph& G, Matrix& d) {//O(V^3)
	d.resize(G.size());
	REP(i, d.size())d[i].resize(G.size());
	REP(i, d.size()) {
		REP(j, d[i].size()) {
			d[i][j] = ((i != j) ? INF : 0);
		}
	}
	REP(i, G.size()) {
		REP(j, G[i].size()) {
			chmin(d[i][G[i][j].to], G[i][j].cap);
		}
	}
	REP(i, G.size()) {
		REP(j, G.size()) {
			REP(k, G.size()) {
				chmin(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}
bool tsort(Graph& graph, Array& order) {//トポロジカルソートO(E+V)
	int n = graph.size(), k = 0;
	Array in(n);
	for (auto& es : graph)
		for (auto& e : es)in[e.to]++;
	priority_queue<ll, Array, greater<ll>> que;
	REP(i, n)
		if (in[i] == 0)que.push(i);
	while (que.size()) {
		int v = que.top();
		que.pop();
		order.push_back(v);
		for (auto& e : graph[v])
			if (--in[e.to] == 0)que.push(e.to);
	}
	if (order.size() != n)return false;
	else return true;
}
class Lca {
public:
	const int n = 0;
	const int log2_n = 0;
	std::vector<std::vector<int>> parent;
	std::vector<int> depth;

	Lca() {}

	Lca(const Graph& g, int root)
		: n(g.size()), log2_n(log2(n) + 1), parent(log2_n, std::vector<int>(n)), depth(n) {
		dfs(g, root, -1, 0);
		for (int k = 0; k + 1 < log2_n; k++) {
			for (int v = 0; v < (int)g.size(); v++) {
				if (parent[k][v] < 0)
					parent[k + 1][v] = -1;
				else
					parent[k + 1][v] = parent[k][parent[k][v]];
			}
		}
	}

	void dfs(const Graph& g, int v, int p, int d) {
		parent[0][v] = p;
		depth[v] = d;
		for (auto& e : g[v]) {
			if (e.to != p) dfs(g, e.to, v, d + 1);
		}
	}

	int get(int u, int v) {
		if (depth[u] > depth[v]) std::swap(u, v);
		for (int k = 0; k < log2_n; k++) {
			if ((depth[v] - depth[u]) >> k & 1) {
				v = parent[k][v];
			}
		}
		if (u == v) return u;
		for (int k = log2_n - 1; k >= 0; k--) {
			if (parent[k][u] != parent[k][v]) {
				u = parent[k][u];
				v = parent[k][v];
			}
		}
		return parent[0][u];
	}
};

class UnionFind {
	vector<int> data;
	ll _num;
public:
	UnionFind(int size) : data(size, -1), _num(size) { }
	bool merge(int x, int y) {//xとyの集合を統合する
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		_num -= (x != y);
		return x != y;
	}
	bool same(int x, int y) {//xとyが同じ集合か返す
		return root(x) == root(y);
	}
	int root(int x) {//xのルートを返す
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	ll size(int x) {//xの集合のサイズを返す
		return -data[root(x)];
	}
	ll num() {//集合の数を返す
		return _num;
	}
};

template<typename T, typename F>
class SegmentTree {
private:
	T identity;
	F merge;
	ll n;
	vector<T> dat;
public:
	SegmentTree(F f, T id, vector<T> v) :merge(f), identity(id) {
		int _n = v.size();
		n = 1;
		while (n < _n)n *= 2;
		dat.resize(2 * n - 1, identity);
		REP(i, _n)dat[n + i - 1] = v[i];
		for (int i = n - 2; i >= 0; i--)dat[i] = merge(dat[i * 2 + 1], dat[i * 2 + 2]);
	}
	SegmentTree(F f, T id, int _n) :merge(f), identity(id) {
		n = 1;
		while (n < _n)n *= 2;
		dat.resize(2 * n - 1, identity);
	}
	void set_val(int i, T x) {
		i += n - 1;
		dat[i] = x;
		while (i > 0) {
			i = (i - 1) / 2;
			dat[i] = merge(dat[i * 2 + 1], dat[i * 2 + 2]);
		}
	}
	T query(int l, int r) {
		T left = identity, right = identity;
		l += n - 1; r += n - 1;
		while (l < r) {
			if ((l & 1) == 0)left = merge(left, dat[l]);
			if ((r & 1) == 0)right = merge(dat[r - 1], right);
			l = l / 2;
			r = (r - 1) / 2;
		}
		return merge(left, right);
	}
};

template< typename T >
class FenwickTree {
	vector< T > data;
	int n;
	int p;
public:
	FenwickTree(int n) :n(n) {
		data.resize(n + 1LL, 0);
		p = 1;
		while (p < data.size())p *= 2;
	}
	T sum(int k) {
		T ret = 0;
		for (; k > 0; k -= k & -k) ret += data[k];
		return (ret);
	}

	T sum(int a, int b) { return sum(b) - sum(a); }//[a,b)

	void add(int k, T x) {
		for (++k; k <= n; k += k & -k) data[k] += x;
	}

	int lower_bound(ll w) {
		if (w <= 0)return -1;
		int x = 0;
		for (int k = p / 2; k > 0; k /= 2) {
			if (x + k <= n && data[x + k] < w)w -= data[x + k], x += k;
		}
		return x;
	}
};

//約数求める //約数
void divisor(ll n, vector<ll>& ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
}

void prime_factorization(ll n, vector<P>& ret) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back({ i,0 });
			while (n % i == 0) {
				n /= i;
				ret[ret.size() - 1].second++;
			}
		}
	}
	if (n != 1)ret.push_back({ n,1 });
}

inline ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

inline ll mod_inv(ll x, ll mod) {
	return mod_pow(x, mod - 2, mod);
}

class Combination {
public:
	Array fact;
	Array fact_inv;
	ll mod;
	//if n >= mod use lucas
	ll nCr(ll n, ll r) {
		if (n < r)return 0;
		if (n < mod)return ((fact[n] * fact_inv[r] % mod) * fact_inv[n - r]) % mod;

		ll ret = 1;
		while (n || r) {
			ll _n = n % mod, _r = r % mod;
			n /= mod; r /= mod;
			(ret *= nCr(_n, _r)) %= mod;
		}
		return ret;
	}
	ll nPr(ll n, ll r) {
		return (fact[n] * fact_inv[n - r]) % mod;
	}
	ll nHr(ll n, ll r) {
		return nCr(r + n - 1, r);
	}
	Combination(ll _n, ll _mod) {
		mod = _mod;
		ll n = min(_n + 1, mod);
		fact.resize(n);
		fact[0] = 1;
		REP(i, n - 1) {
			fact[i + 1] = (fact[i] * (i + 1LL)) % mod;
		}
		fact_inv.resize(n);
		fact_inv[n - 1] = mod_inv(fact[n - 1], mod);
		for (int i = n - 1; i > 0; i--) {
			fact_inv[i - 1] = fact_inv[i] * i % mod;
		}
	}
};

ll popcount(ll x) {
	x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
	x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
	x = (x & 0x0F0F0F0F0F0F0F0F) + (x >> 4 & 0x0F0F0F0F0F0F0F0F);
	x = (x & 0x00FF00FF00FF00FF) + (x >> 8 & 0x00FF00FF00FF00FF);
	x = (x & 0x0000FFFF0000FFFF) + (x >> 16 & 0x0000FFFF0000FFFF);
	x = (x & 0x00000000FFFFFFFF) + (x >> 32 & 0x00000000FFFFFFFF);

	return x;
}

template<typename T, typename E, typename F, typename G, typename H, typename P>
class LazySegmentTree {
private:
	const T identity_t;
	const E identity_e;
	F f_tt;
	G f_te;
	H f_ee;
	P f_ep;//区間に比例する場合
	vector<T> dat;
	vector<E> lazy;
	int n;
	void eval(int k, int len) {
		if (lazy[k] == identity_e)return;
		if (k < n - 1) {
			lazy[2 * k + 1] = f_ee(lazy[2 * k + 1], lazy[k]);
			lazy[2 * k + 2] = f_ee(lazy[2 * k + 2], lazy[k]);
		}
		dat[k] = f_te(dat[k], f_ep(lazy[k], len));
		lazy[k] = identity_e;
	}
	void update(int a, int b, E x, int k, int l, int r) {
		eval(k, r - l);
		if (a <= l && r <= b) {
			lazy[k] = f_ee(lazy[k], x);
			eval(k, r - l);
		}
		else if (a < r && l < b) {
			update(a, b, x, k * 2 + 1, l, (l + r) / 2);
			update(a, b, x, k * 2 + 2, (l + r) / 2, r);
			dat[k] = f_tt(dat[2 * k + 1], dat[2 * k + 2]);
		}
	}
	T query(int a, int b, int k, int l, int r) {
		eval(k, r - l);
		if (r <= a || b <= l)return identity_t;
		else if (a <= l && r <= b)return dat[k];
		else {
			T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
			T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
			return f_tt(vl, vr);
		}
	}
public:
	LazySegmentTree(vector<T> v, T id_t, E id_e, F f, G g, H h, P p) :
		identity_t(id_t), identity_e(id_e), f_tt(f), f_te(g), f_ee(h), f_ep(p) {
		n = 1;
		while (n < v.size())n *= 2;
		dat.resize(2 * n - 1, identity_t);
		lazy.resize(2 * n - 1, identity_e);
		REP(i, v.size())dat[n + i - 1] = v[i];
		for (int i = n - 2; i >= 0; i--)dat[i] = f_tt(dat[i * 2 + 1], dat[i * 2 + 2]);

	}
	void update(int a, int b, E x) { update(a, b, x, 0, 0, n); }
	T query(int a, int b) { return query(a, b, 0, 0, n); }
};

Matrix mIdentity(ll n) {
	Matrix A(n, Array(n));
	for (int i = 0; i < n; ++i) A[i][i] = 1;
	return A;
}

Matrix mMul(const Matrix& A, const Matrix& B,ll M) {
	Matrix C(A.size(), Array(B[0].size()));
	for (int i = 0; i < C.size(); ++i)
		for (int k = 0; k < A[i].size(); ++k)
			for (int j = 0; j < C[i].size(); ++j)
				(C[i][j] += (A[i][k] % M) * (B[k][j] % M)) %= M;
	return C;
}
// O( n^3 log e )
Matrix mPow(const Matrix& A, ll e , ll M) {
	return e == 0 ? mIdentity(A.size()) :
		e % 2 == 0 ? mPow(mMul(A, A, M), e / 2, M) : mMul(A, mPow(A, e - 1, M), M);
}

template<ll mod, ll root>//特殊な素数と原始根　998244353のとき3
class NTT {
private:
	template<typename T>
	inline void bit_reverse(vector<T>& a) {
		int n = a.size();
		int i = 0;
		for (int j = 1; j < n - 1; ++j) {
			for (int k = n >> 1; k > (i ^= k); k >>= 1);
			if (j < i) swap(a[i], a[j]);
		}
	}
	void _ntt(vector<long long>& a, int sign) {
		const int n = a.size();
		assert((n ^ (n & -n)) == 0); //n = 2^k

		long long tmp = (mod - 1) * mod_pow((ll)n, mod - 2, mod) % mod; // -1/n
		long long h = mod_pow(root, tmp, mod); // ^n√g
		if (sign == -1) h = mod_pow(h, mod - 2, mod);

		bit_reverse(a);

		for (ll m = 1; m < n; m <<= 1) {
			const ll m2 = 2 * m;
			long long _base = mod_pow((ll)h, (ll)(n / m2), mod);
			long long _w = 1;
			for (int x = 0; x < m; ++x) {
				for (ll s = x; s < n; s += m2) {
					long long u = a[s];
					long long d = (a[s + m] * _w) % mod;
					a[s] = (u + d) % mod;
					a[s + m] = (u - d + mod) % mod;
				}
				_w = (_w * _base) % mod;
			}
		}
	}

	void ntt(vector<long long>& input) { _ntt(input, 1); }

	void intt(vector<long long>& input) {
		_ntt(input, -1);
		const long long n_inv = mod_pow((ll)input.size(), mod - 2, mod);
		for (auto& x : input) x = (x * n_inv) % mod;
	}
public:
	// 畳み込み演算を行う
	vector<long long> convolution(const vector<long long>& a, const vector<long long>& b) {
		int result_size = a.size() + b.size() - 1;
		int n = 1; while (n < result_size) n <<= 1;

		vector<long long> _a = a, _b = b;
		_a.resize(n, 0);
		_b.resize(n, 0);

		ntt(_a);
		ntt(_b);
		for (int i = 0; i < n; ++i) _a[i] = (_a[i] * _b[i]) % mod;

		intt(_a);

		_a.resize(result_size);
		return _a;
	}
};

class StronglyConnectedComponents {
private:
	int n;
	Graph& g;
	void visit(int v, stack<int>& S, vector<int>& inS, vector<int>& low, vector<int>& num, int& time) {
		low[v] = num[v] = ++time;
		S.push(v); inS[v] = true;
		for (auto e : g[v]) {
			int w = e.to;
			if (num[w] == 0) {
				visit(w, S, inS, low, num, time);
				low[v] = min(low[v], low[w]);
			}
			else if (inS[w])
				low[v] = min(low[v], num[w]);
		}
		if (low[v] == num[v]) {
			scc.push_back(vector<int>());
			while (1) {
				int w = S.top(); S.pop(); inS[w] = false;
				scc.back().push_back(w);
				comp[w] = scc.size() - 1;
				if (v == w) break;
			}
		}
	}
public:
	vector2<int> scc;
	vector<int> comp;
	StronglyConnectedComponents(Graph& _g) :g(_g) {
		n = g.size();
		comp.resize(n);
		vector<int> num(n), low(n);
		stack<int> S;
		vector<int> inS(n);
		int time = 0;
		REP(u, n)if (num[u] == 0)visit(u, S, inS, low, num, time);
	}
	void build(Graph& t) {
		t.resize(scc.size());
		map<pair<int, int>, int> mp;
		REP(i, n) {
			int u = comp[i];
			for (auto e : g[i]) {
				int v = comp[e.to];
				if (u != v && mp.count({ u,v }) == 0)add_edge(t, u, v, 1, false, 0), mp[{u, v}] = 1;
			}
		}
	}
};

class HeavyLightDecomposition {
private:
	Graph& g;
	int n, root;
	vector<int> sz, par, in, out, head, rev, dep;
	void dfs_sz(int v, int p) {
		sz[v] = 1, par[v] = p;
		for (auto& e : g[v]) {
			if (e.to == p)swap(e, g[v].back());
			if (e.to == p)continue;
			dep[e.to] = dep[v] + 1;
			dfs_sz(e.to, v);
			sz[v] += sz[e.to];
			if (sz[e.to] > sz[g[v][0].to])swap(e, g[v][0]);
		}
	}
	void dfs_hld(int v, int p, int& t) {
		in[v] = t++; rev[in[v]] = v;
		for (auto e : g[v]) {
			if (e.to == p)continue;
			head[e.to] = (e.to == g[v][0].to ? head[v] : e.to);
			dfs_hld(e.to, v, t);
		}
		out[v] = t;
	}
public:
	HeavyLightDecomposition(Graph& _g, int _root = 0)
		:g(_g), n(g.size()), root(_root), sz(n), par(n, -1), head(n, -1), in(n), out(n), rev(n), dep(n, 0) {
		dfs_sz(root, -1);
		int t = 0;
		head[root] = root;
		dfs_hld(root, -1, t);
	}
	inline int get_in(int a) { return in[a]; }
	inline int get_sz(int a) { return sz[a]; }
	inline int get_rev(int a) { return rev[a]; }
	inline int get_dep(int a) { return dep[a]; }
	int lca(int a, int b) {
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])return a;
		}
	}
	P subtree_query(int a) { return { in[a], out[a] }; }
	vector<P> path_query(int a, int b, bool edge = false) {
		vector<P> ret;
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])break;
			ret.push_back({ in[head[b]],in[b] + 1 });
		}
		ret.push_back({ in[a] + edge,in[b] + 1 });
		return ret;
	}
};

template<typename E, typename H >
class DuelSegmentTree {
private:
	int sz, height;
	vector<E> lazy;
	const E identity_e;
	H f_ee;

	inline void propagate(int k) {
		if (lazy[k] != identity_e) {
			lazy[2 * k + 0] = f_ee(lazy[2 * k + 0], lazy[k]);
			lazy[2 * k + 1] = f_ee(lazy[2 * k + 1], lazy[k]);
			lazy[k] = identity_e;
		}
	}

	inline void thrust(int k) {
		for (int i = height; i > 0; i--) propagate(k >> i);
	}

public:
	DuelSegmentTree(int n, E id_e, H h) :
		identity_e(id_e), f_ee(h) {
		sz = 1;
		height = 0;
		while (sz < n) sz <<= 1, height++;
		lazy.resize(2 * sz, identity_e);
	}

	void update(int a, int b, const E& x) {
		thrust(a += sz);
		thrust(b += sz - 1);
		for (int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
			if (l & 1) lazy[l] = f_ee(lazy[l], x), ++l;
			if (r & 1) --r, lazy[r] = f_ee(lazy[r], x);
		}
	}

	E operator[](int k) {
		thrust(k += sz);
		return lazy[k];
	}
};

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	constexpr ll mod = 998244353;

	ll n;
	cin >> n;
	n *= 2;
	Array a(n);
	REP(i, n)cin >> a[i];
	sort(all(a));
	if (a[n / 2 - 1] == a[n / 2])cout << "NO" << "\n";
	else cout << "YES" << "\n";

	return 0;
}


#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include<numeric>
#include<functional>

using namespace std;
#define ll long long
#define ull unsigned long long
#define rrep(i,m,n) for(ll (i)=(ll)(m);(i)>=(ll)(n);(i)--)
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 62;
constexpr long double EPS = 1e-10;
template<typename T> using vector2 = vector<vector<T>>;
template<typename T> using vector3 = vector<vector2<T>>;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
string operator*(const string& s, int k) {
	if (k == 0) return "";
	string p = (s + s) * (k / 2);
	if (k % 2 == 1) p += s;
	return p;
}

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

struct Edge {//グラフ
	int to, rev; ll cap;
	Edge(int _to, ll _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph& G, int from, int to, ll cap, bool revFlag, ll revCap) {//最大フロー求める Ford-fulkerson
	G[from].push_back(Edge(to, cap, (ll)G[to].size() + (from == to)));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));//最小カットの場合逆辺は0にする
}

ll max_flow_dfs(Graph& G, ll v, ll t, ll f, vector<bool>& used)
{
	if (v == t)
		return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i) {
		Edge& e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			ll d = max_flow_dfs(G, e.to, t, min(f, e.cap), used);
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
//二分グラフの最大マッチングを求めたりも出来る　また二部グラフの最大独立集合は頂点数-最大マッチングのサイズ
ll max_flow(Graph& G, ll s, ll t)//O(V(V+E))
{
	ll flow = 0;
	for (;;) {
		vector<bool> used(G.size());
		REP(i, used.size())used[i] = false;
		ll f = max_flow_dfs(G, s, t, INF, used);
		if (f == 0) {
			return flow;
		}
		flow += f;
	}
}

void BellmanFord(Graph& G, ll s, Array& d, Array& negative) {//O(|E||V|)
	d.resize(G.size());
	negative.resize(G.size());
	REP(i, d.size())d[i] = INF;
	REP(i, d.size())negative[i] = false;
	d[s] = 0;
	REP(k, G.size() - 1) {
		REP(i, G.size()) {
			REP(j, G[i].size()) {
				if (d[i] != INF && d[G[i][j].to] > d[i] + G[i][j].cap) {
					d[G[i][j].to] = d[i] + G[i][j].cap;
				}
			}
		}
	}
	REP(k, G.size() - 1) {
		REP(i, G.size()) {
			REP(j, G[i].size()) {
				if (d[i] != INF && d[G[i][j].to] > d[i] + G[i][j].cap) {
					d[G[i][j].to] = d[i] + G[i][j].cap;
					negative[G[i][j].to] = true;
				}
				if (negative[i] == true)negative[G[i][j].to] = true;
			}
		}
	}
}
void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
	d.resize(G.size());
	REP(i, d.size())d[i] = INF;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(make_pair(0, s));
	while (!q.empty()) {
		P a = q.top();
		q.pop();
		if (d[a.second] < a.first)continue;
		REP(i, G[a.second].size()) {
			Edge e = G[a.second][i];
			if (d[e.to] > d[a.second] + e.cap) {
				d[e.to] = d[a.second] + e.cap;
				q.push(make_pair(d[e.to], e.to));
			}
		}
	}
}
void WarshallFloyd(Graph& G, Matrix& d) {//O(V^3)
	d.resize(G.size());
	REP(i, d.size())d[i].resize(G.size());
	REP(i, d.size()) {
		REP(j, d[i].size()) {
			d[i][j] = ((i != j) ? INF : 0);
		}
	}
	REP(i, G.size()) {
		REP(j, G[i].size()) {
			chmin(d[i][G[i][j].to], G[i][j].cap);
		}
	}
	REP(i, G.size()) {
		REP(j, G.size()) {
			REP(k, G.size()) {
				chmin(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}
bool tsort(Graph& graph, Array& order) {//トポロジカルソートO(E+V)
	int n = graph.size(), k = 0;
	Array in(n);
	for (auto& es : graph)
		for (auto& e : es)in[e.to]++;
	priority_queue<ll, Array, greater<ll>> que;
	REP(i, n)
		if (in[i] == 0)que.push(i);
	while (que.size()) {
		int v = que.top();
		que.pop();
		order.push_back(v);
		for (auto& e : graph[v])
			if (--in[e.to] == 0)que.push(e.to);
	}
	if (order.size() != n)return false;
	else return true;
}
class Lca {
public:
	const int n = 0;
	const int log2_n = 0;
	std::vector<std::vector<int>> parent;
	std::vector<int> depth;

	Lca() {}

	Lca(const Graph& g, int root)
		: n(g.size()), log2_n(log2(n) + 1), parent(log2_n, std::vector<int>(n)), depth(n) {
		dfs(g, root, -1, 0);
		for (int k = 0; k + 1 < log2_n; k++) {
			for (int v = 0; v < (int)g.size(); v++) {
				if (parent[k][v] < 0)
					parent[k + 1][v] = -1;
				else
					parent[k + 1][v] = parent[k][parent[k][v]];
			}
		}
	}

	void dfs(const Graph& g, int v, int p, int d) {
		parent[0][v] = p;
		depth[v] = d;
		for (auto& e : g[v]) {
			if (e.to != p) dfs(g, e.to, v, d + 1);
		}
	}

	int get(int u, int v) {
		if (depth[u] > depth[v]) std::swap(u, v);
		for (int k = 0; k < log2_n; k++) {
			if ((depth[v] - depth[u]) >> k & 1) {
				v = parent[k][v];
			}
		}
		if (u == v) return u;
		for (int k = log2_n - 1; k >= 0; k--) {
			if (parent[k][u] != parent[k][v]) {
				u = parent[k][u];
				v = parent[k][v];
			}
		}
		return parent[0][u];
	}
};

class UnionFind {
	vector<int> data;
	ll _num;
public:
	UnionFind(int size) : data(size, -1), _num(size) { }
	bool merge(int x, int y) {//xとyの集合を統合する
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		_num -= (x != y);
		return x != y;
	}
	bool same(int x, int y) {//xとyが同じ集合か返す
		return root(x) == root(y);
	}
	int root(int x) {//xのルートを返す
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	ll size(int x) {//xの集合のサイズを返す
		return -data[root(x)];
	}
	ll num() {//集合の数を返す
		return _num;
	}
};

template<typename T, typename F>
class SegmentTree {
private:
	T identity;
	F merge;
	ll n;
	vector<T> dat;
public:
	SegmentTree(F f, T id, vector<T> v) :merge(f), identity(id) {
		int _n = v.size();
		n = 1;
		while (n < _n)n *= 2;
		dat.resize(2 * n - 1, identity);
		REP(i, _n)dat[n + i - 1] = v[i];
		for (int i = n - 2; i >= 0; i--)dat[i] = merge(dat[i * 2 + 1], dat[i * 2 + 2]);
	}
	SegmentTree(F f, T id, int _n) :merge(f), identity(id) {
		n = 1;
		while (n < _n)n *= 2;
		dat.resize(2 * n - 1, identity);
	}
	void set_val(int i, T x) {
		i += n - 1;
		dat[i] = x;
		while (i > 0) {
			i = (i - 1) / 2;
			dat[i] = merge(dat[i * 2 + 1], dat[i * 2 + 2]);
		}
	}
	T query(int l, int r) {
		T left = identity, right = identity;
		l += n - 1; r += n - 1;
		while (l < r) {
			if ((l & 1) == 0)left = merge(left, dat[l]);
			if ((r & 1) == 0)right = merge(dat[r - 1], right);
			l = l / 2;
			r = (r - 1) / 2;
		}
		return merge(left, right);
	}
};

template< typename T >
class FenwickTree {
	vector< T > data;
	int n;
	int p;
public:
	FenwickTree(int n) :n(n) {
		data.resize(n + 1LL, 0);
		p = 1;
		while (p < data.size())p *= 2;
	}
	T sum(int k) {
		T ret = 0;
		for (; k > 0; k -= k & -k) ret += data[k];
		return (ret);
	}

	T sum(int a, int b) { return sum(b) - sum(a); }//[a,b)

	void add(int k, T x) {
		for (++k; k <= n; k += k & -k) data[k] += x;
	}

	int lower_bound(ll w) {
		if (w <= 0)return -1;
		int x = 0;
		for (int k = p / 2; k > 0; k /= 2) {
			if (x + k <= n && data[x + k] < w)w -= data[x + k], x += k;
		}
		return x;
	}
};

//約数求める //約数
void divisor(ll n, vector<ll>& ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
}

void prime_factorization(ll n, vector<P>& ret) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back({ i,0 });
			while (n % i == 0) {
				n /= i;
				ret[ret.size() - 1].second++;
			}
		}
	}
	if (n != 1)ret.push_back({ n,1 });
}

inline ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

inline ll mod_inv(ll x, ll mod) {
	return mod_pow(x, mod - 2, mod);
}

class Combination {
public:
	Array fact;
	Array fact_inv;
	ll mod;
	//if n >= mod use lucas
	ll nCr(ll n, ll r) {
		if (n < r)return 0;
		if (n < mod)return ((fact[n] * fact_inv[r] % mod) * fact_inv[n - r]) % mod;

		ll ret = 1;
		while (n || r) {
			ll _n = n % mod, _r = r % mod;
			n /= mod; r /= mod;
			(ret *= nCr(_n, _r)) %= mod;
		}
		return ret;
	}
	ll nPr(ll n, ll r) {
		return (fact[n] * fact_inv[n - r]) % mod;
	}
	ll nHr(ll n, ll r) {
		return nCr(r + n - 1, r);
	}
	Combination(ll _n, ll _mod) {
		mod = _mod;
		ll n = min(_n + 1, mod);
		fact.resize(n);
		fact[0] = 1;
		REP(i, n - 1) {
			fact[i + 1] = (fact[i] * (i + 1LL)) % mod;
		}
		fact_inv.resize(n);
		fact_inv[n - 1] = mod_inv(fact[n - 1], mod);
		for (int i = n - 1; i > 0; i--) {
			fact_inv[i - 1] = fact_inv[i] * i % mod;
		}
	}
};

ll popcount(ll x) {
	x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
	x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
	x = (x & 0x0F0F0F0F0F0F0F0F) + (x >> 4 & 0x0F0F0F0F0F0F0F0F);
	x = (x & 0x00FF00FF00FF00FF) + (x >> 8 & 0x00FF00FF00FF00FF);
	x = (x & 0x0000FFFF0000FFFF) + (x >> 16 & 0x0000FFFF0000FFFF);
	x = (x & 0x00000000FFFFFFFF) + (x >> 32 & 0x00000000FFFFFFFF);

	return x;
}

template<typename T, typename E, typename F, typename G, typename H, typename P>
class LazySegmentTree {
private:
	const T identity_t;
	const E identity_e;
	F f_tt;
	G f_te;
	H f_ee;
	P f_ep;//区間に比例する場合
	vector<T> dat;
	vector<E> lazy;
	int n;
	void eval(int k, int len) {
		if (lazy[k] == identity_e)return;
		if (k < n - 1) {
			lazy[2 * k + 1] = f_ee(lazy[2 * k + 1], lazy[k]);
			lazy[2 * k + 2] = f_ee(lazy[2 * k + 2], lazy[k]);
		}
		dat[k] = f_te(dat[k], f_ep(lazy[k], len));
		lazy[k] = identity_e;
	}
	void update(int a, int b, E x, int k, int l, int r) {
		eval(k, r - l);
		if (a <= l && r <= b) {
			lazy[k] = f_ee(lazy[k], x);
			eval(k, r - l);
		}
		else if (a < r && l < b) {
			update(a, b, x, k * 2 + 1, l, (l + r) / 2);
			update(a, b, x, k * 2 + 2, (l + r) / 2, r);
			dat[k] = f_tt(dat[2 * k + 1], dat[2 * k + 2]);
		}
	}
	T query(int a, int b, int k, int l, int r) {
		eval(k, r - l);
		if (r <= a || b <= l)return identity_t;
		else if (a <= l && r <= b)return dat[k];
		else {
			T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
			T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
			return f_tt(vl, vr);
		}
	}
public:
	LazySegmentTree(vector<T> v, T id_t, E id_e, F f, G g, H h, P p) :
		identity_t(id_t), identity_e(id_e), f_tt(f), f_te(g), f_ee(h), f_ep(p) {
		n = 1;
		while (n < v.size())n *= 2;
		dat.resize(2 * n - 1, identity_t);
		lazy.resize(2 * n - 1, identity_e);
		REP(i, v.size())dat[n + i - 1] = v[i];
		for (int i = n - 2; i >= 0; i--)dat[i] = f_tt(dat[i * 2 + 1], dat[i * 2 + 2]);

	}
	void update(int a, int b, E x) { update(a, b, x, 0, 0, n); }
	T query(int a, int b) { return query(a, b, 0, 0, n); }
};

Matrix mIdentity(ll n) {
	Matrix A(n, Array(n));
	for (int i = 0; i < n; ++i) A[i][i] = 1;
	return A;
}

Matrix mMul(const Matrix& A, const Matrix& B,ll M) {
	Matrix C(A.size(), Array(B[0].size()));
	for (int i = 0; i < C.size(); ++i)
		for (int k = 0; k < A[i].size(); ++k)
			for (int j = 0; j < C[i].size(); ++j)
				(C[i][j] += (A[i][k] % M) * (B[k][j] % M)) %= M;
	return C;
}
// O( n^3 log e )
Matrix mPow(const Matrix& A, ll e , ll M) {
	return e == 0 ? mIdentity(A.size()) :
		e % 2 == 0 ? mPow(mMul(A, A, M), e / 2, M) : mMul(A, mPow(A, e - 1, M), M);
}

template<ll mod, ll root>//特殊な素数と原始根　998244353のとき3
class NTT {
private:
	template<typename T>
	inline void bit_reverse(vector<T>& a) {
		int n = a.size();
		int i = 0;
		for (int j = 1; j < n - 1; ++j) {
			for (int k = n >> 1; k > (i ^= k); k >>= 1);
			if (j < i) swap(a[i], a[j]);
		}
	}
	void _ntt(vector<long long>& a, int sign) {
		const int n = a.size();
		assert((n ^ (n & -n)) == 0); //n = 2^k

		long long tmp = (mod - 1) * mod_pow((ll)n, mod - 2, mod) % mod; // -1/n
		long long h = mod_pow(root, tmp, mod); // ^n√g
		if (sign == -1) h = mod_pow(h, mod - 2, mod);

		bit_reverse(a);

		for (ll m = 1; m < n; m <<= 1) {
			const ll m2 = 2 * m;
			long long _base = mod_pow((ll)h, (ll)(n / m2), mod);
			long long _w = 1;
			for (int x = 0; x < m; ++x) {
				for (ll s = x; s < n; s += m2) {
					long long u = a[s];
					long long d = (a[s + m] * _w) % mod;
					a[s] = (u + d) % mod;
					a[s + m] = (u - d + mod) % mod;
				}
				_w = (_w * _base) % mod;
			}
		}
	}

	void ntt(vector<long long>& input) { _ntt(input, 1); }

	void intt(vector<long long>& input) {
		_ntt(input, -1);
		const long long n_inv = mod_pow((ll)input.size(), mod - 2, mod);
		for (auto& x : input) x = (x * n_inv) % mod;
	}
public:
	// 畳み込み演算を行う
	vector<long long> convolution(const vector<long long>& a, const vector<long long>& b) {
		int result_size = a.size() + b.size() - 1;
		int n = 1; while (n < result_size) n <<= 1;

		vector<long long> _a = a, _b = b;
		_a.resize(n, 0);
		_b.resize(n, 0);

		ntt(_a);
		ntt(_b);
		for (int i = 0; i < n; ++i) _a[i] = (_a[i] * _b[i]) % mod;

		intt(_a);

		_a.resize(result_size);
		return _a;
	}
};

class StronglyConnectedComponents {
private:
	int n;
	Graph& g;
	void visit(int v, stack<int>& S, vector<int>& inS, vector<int>& low, vector<int>& num, int& time) {
		low[v] = num[v] = ++time;
		S.push(v); inS[v] = true;
		for (auto e : g[v]) {
			int w = e.to;
			if (num[w] == 0) {
				visit(w, S, inS, low, num, time);
				low[v] = min(low[v], low[w]);
			}
			else if (inS[w])
				low[v] = min(low[v], num[w]);
		}
		if (low[v] == num[v]) {
			scc.push_back(vector<int>());
			while (1) {
				int w = S.top(); S.pop(); inS[w] = false;
				scc.back().push_back(w);
				comp[w] = scc.size() - 1;
				if (v == w) break;
			}
		}
	}
public:
	vector2<int> scc;
	vector<int> comp;
	StronglyConnectedComponents(Graph& _g) :g(_g) {
		n = g.size();
		comp.resize(n);
		vector<int> num(n), low(n);
		stack<int> S;
		vector<int> inS(n);
		int time = 0;
		REP(u, n)if (num[u] == 0)visit(u, S, inS, low, num, time);
	}
	void build(Graph& t) {
		t.resize(scc.size());
		map<pair<int, int>, int> mp;
		REP(i, n) {
			int u = comp[i];
			for (auto e : g[i]) {
				int v = comp[e.to];
				if (u != v && mp.count({ u,v }) == 0)add_edge(t, u, v, 1, false, 0), mp[{u, v}] = 1;
			}
		}
	}
};

class HeavyLightDecomposition {
private:
	Graph& g;
	int n, root;
	vector<int> sz, par, in, out, head, rev, dep;
	void dfs_sz(int v, int p) {
		sz[v] = 1, par[v] = p;
		for (auto& e : g[v]) {
			if (e.to == p)swap(e, g[v].back());
			if (e.to == p)continue;
			dep[e.to] = dep[v] + 1;
			dfs_sz(e.to, v);
			sz[v] += sz[e.to];
			if (sz[e.to] > sz[g[v][0].to])swap(e, g[v][0]);
		}
	}
	void dfs_hld(int v, int p, int& t) {
		in[v] = t++; rev[in[v]] = v;
		for (auto e : g[v]) {
			if (e.to == p)continue;
			head[e.to] = (e.to == g[v][0].to ? head[v] : e.to);
			dfs_hld(e.to, v, t);
		}
		out[v] = t;
	}
public:
	HeavyLightDecomposition(Graph& _g, int _root = 0)
		:g(_g), n(g.size()), root(_root), sz(n), par(n, -1), head(n, -1), in(n), out(n), rev(n), dep(n, 0) {
		dfs_sz(root, -1);
		int t = 0;
		head[root] = root;
		dfs_hld(root, -1, t);
	}
	inline int get_in(int a) { return in[a]; }
	inline int get_sz(int a) { return sz[a]; }
	inline int get_rev(int a) { return rev[a]; }
	inline int get_dep(int a) { return dep[a]; }
	int lca(int a, int b) {
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])return a;
		}
	}
	P subtree_query(int a) { return { in[a], out[a] }; }
	vector<P> path_query(int a, int b, bool edge = false) {
		vector<P> ret;
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])break;
			ret.push_back({ in[head[b]],in[b] + 1 });
		}
		ret.push_back({ in[a] + edge,in[b] + 1 });
		return ret;
	}
};

template<typename E, typename H >
class DuelSegmentTree {
private:
	int sz, height;
	vector<E> lazy;
	const E identity_e;
	H f_ee;

	inline void propagate(int k) {
		if (lazy[k] != identity_e) {
			lazy[2 * k + 0] = f_ee(lazy[2 * k + 0], lazy[k]);
			lazy[2 * k + 1] = f_ee(lazy[2 * k + 1], lazy[k]);
			lazy[k] = identity_e;
		}
	}

	inline void thrust(int k) {
		for (int i = height; i > 0; i--) propagate(k >> i);
	}

public:
	DuelSegmentTree(int n, E id_e, H h) :
		identity_e(id_e), f_ee(h) {
		sz = 1;
		height = 0;
		while (sz < n) sz <<= 1, height++;
		lazy.resize(2 * sz, identity_e);
	}

	void update(int a, int b, const E& x) {
		thrust(a += sz);
		thrust(b += sz - 1);
		for (int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
			if (l & 1) lazy[l] = f_ee(lazy[l], x), ++l;
			if (r & 1) --r, lazy[r] = f_ee(lazy[r], x);
		}
	}

	E operator[](int k) {
		thrust(k += sz);
		return lazy[k];
	}
};

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	constexpr ll mod = 998244353;

	ll n;
	cin >> n;
	n *= 2;
	Array a(n);
	REP(i, n)cin >> a[i];
	sort(all(a));
	REP(i, n / 2) {
		if (a[i] == a[i + n / 2]) {
			cout << "NO" << "\n";
			return 0;
		}
	}
	cout << "YES" << "\n";

	return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define foriter(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define endl '\n'
#define INF (ll)(1e9)
#define EPS 1e-9
#define MOD (ll)(1e9+7)
#define PI 3.1415926535897932384626433832795
#define set set
#define mset multiset
#define uset unordered_set
#define umset unordered_multiset
#define map map
#define mmap multimap
#define umap unordered_map
#define ummap unordered_multimap

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vll;
typedef vector<vll> vvll;
typedef pair<i64, i64> pll;

int inp(){
  int x;
  cin>>x;
  return x;
}

//=============================================================================//

void solve() {
    int n; cin>>n;
    vector<int> s;
    for0(i, 2*n){
        int in; cin>>in;
        s.pb(in);
    }
    cout<<(s[n-1]!=s[n]?"YES":"NO");
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int T=1;
    //cin >> T;
    while (T--) {
        solve();
        cout<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define foriter(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define endl '\n'
#define INF (ll)(1e9)
#define EPS 1e-9
#define MOD (ll)(1e9+7)
#define PI 3.1415926535897932384626433832795
#define set set
#define mset multiset
#define uset unordered_set
#define umset unordered_multiset
#define map map
#define mmap multimap
#define umap unordered_map
#define ummap unordered_multimap

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vll;
typedef vector<vll> vvll;
typedef pair<i64, i64> pll;

int inp(){
  int x;
  cin>>x;
  return x;
}

//=============================================================================//

void solve() {
    int n; cin>>n;
    set<int> s;
    for0(i, 2*n){
        int in; cin>>in;
        s.insert(in);
    }
    cout<<(s.size()>1?"YES":"NO");
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int T=1;
    //cin >> T;
    while (T--) {
        solve();
        cout<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define foriter(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define endl '\n'
#define INF (ll)(1e9)
#define EPS 1e-9
#define MOD (ll)(1e9+7)
#define PI 3.1415926535897932384626433832795
#define set set
#define mset multiset
#define uset unordered_set
#define umset unordered_multiset
#define map map
#define mmap multimap
#define umap unordered_map
#define ummap unordered_multimap

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vll;
typedef vector<vll> vvll;
typedef pair<i64, i64> pll;

int inp(){
  int x;
  cin>>x;
  return x;
}

//=============================================================================//

void solve() {
    int n; cin>>n;
    vector<int> s;
    for0(i, 2*n){
        int in; cin>>in;
        s.pb(in);
    }
    sort(all(s));
    cout<<(s[n-1]!=s[n]?"YES":"NO");
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int T=1;
    //cin >> T;
    while (T--) {
        solve();
        cout<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout);
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
const int N = 5e5 + 100;
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;

int main ()
{
	data();
	int n;
	cin >> n;
	int a[n * 2 + 1];
	for (int i = 1; i <= n * 2; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	sort(a + 1, a + n * 2 + 1);
	if (a[1] == a[n + 1])
	{
		cout << "NO";
	}
	else {
		cout << "YES";
	}
}
//If at first you dont succeed, laugh until you do..


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout);
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
const int N = 5e5 + 100;
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;

int main ()
{
	data();
	int n;
	cin >> n;
	int a[n * 2 + 1];
	for (int i = 1; i <= n * 2; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	sort(a + 1, a + n + 1);
	if (a[1] == a[n + 1])
	{
		cout << "NO";
	}
	else {
		cout << "YES";
	}
}
//If at first you dont succeed, laugh until you do..


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout);
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
const int N = 5e5 + 100;
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;

int main ()
{
	data();
	int n;
	cin >> n;
	int a[n * 2 + 1];
	int k = n;
	n *= 2;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	sort(a + 1, a + n + 1);
	if (a[k] == a[k + 1])
	{
		cout << "NO";
	}
	else {
		cout << "YES";
	}
}
//If at first you dont succeed, laugh until you do..


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout);
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
const int N = 5e5 + 100;
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;

int main ()
{
	data();
	int n;
	cin >> n;
	int a[n * 2 + 1];
	for (int i = 1; i <= n * 2; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	sort(a + 1, a + n + 1);
	if (a[n] == a[n + 1])
	{
		cout << "NO";
	}
	else {
		cout << "YES";
	}
}
//If at first you dont succeed, laugh until you do..


#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout);
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
const int N = 5e5 + 100;
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;

int main ()
{
	data();
	int n;
	cin >> n;
	int a[n * 2 + 1];
	n *= 2;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	sort(a + 1, a + n + 1);
	if (a[n] == a[n + 1])
	{
		cout << "NO";
	}
	else {
		cout << "YES";
	}
}
//If at first you dont succeed, laugh until you do..


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long int
#define pii pair<int, int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define mii map<int, int>
#define MAX 2000002
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcount(x)
#define zrobits(x) __builtin_ctz(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define FIO                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

/*void sieve(int p[],int n)
            {
                for(int i=3;i<=n;i+=2)
                {
                    p[i]=1;
                }
                //Sieve
                for(int i=3;i<=n;i++)
                {
                    if(p[i] == 1)
                    {
                        for(int j=i*i;j<=n;j+=i)
                        {
                            p[j]=0;
                        }
                    }
                }
                p[2]=1;
                p[0]=p[1]=0;
            }*/

int recpow(int x, int n)
{
    if (n == 0)
        return 1;
    else if (n % 2 == 0) //n is even
        return recpow((x * x), n / 2);
    else //n is odd
        return (x * recpow((x * x), (n - 1) / 2));
}

/*int modInverse(int n, int p)
            {
                return recpow(n, p - 2);
            }

            int nCrModPFermat(int n, int r)
            {
                if (r == 0)
                    return 1;
                int fac[n + 1];
                fac[0] = 1;
                for (int i = 1; i <= n; i++)
                    fac[i] = fac[i - 1] * i % M;

                return (fac[n] * modInverse(fac[r], M) % M * modInverse(fac[n - r], M) % M) % M;
            }*/

int32_t main()
{
    FIO;
    int n;
    cin>>n;
    int a[2*n];
    rep(i,2*n)
    cin>>a[i];
    sort(a,a+2*n);
    if(a[n-1]==a[n])
    cout<<"NO\n";
    else
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long int
#define pii pair<int, int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define mii map<int, int>
#define MAX 2000002
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcount(x)
#define zrobits(x) __builtin_ctz(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define FIO                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

/*void sieve(int p[],int n)
            {
                for(int i=3;i<=n;i+=2)
                {
                    p[i]=1;
                }
                //Sieve
                for(int i=3;i<=n;i++)
                {
                    if(p[i] == 1)
                    {
                        for(int j=i*i;j<=n;j+=i)
                        {
                            p[j]=0;
                        }
                    }
                }
                p[2]=1;
                p[0]=p[1]=0;
            }*/

int recpow(int x, int n)
{
    if (n == 0)
        return 1;
    else if (n % 2 == 0) //n is even
        return recpow((x * x), n / 2);
    else //n is odd
        return (x * recpow((x * x), (n - 1) / 2));
}

/*int modInverse(int n, int p)
            {
                return recpow(n, p - 2);
            }

            int nCrModPFermat(int n, int r)
            {
                if (r == 0)
                    return 1;
                int fac[n + 1];
                fac[0] = 1;
                for (int i = 1; i <= n; i++)
                    fac[i] = fac[i - 1] * i % M;

                return (fac[n] * modInverse(fac[r], M) % M * modInverse(fac[n - r], M) % M) % M;
            }*/

int32_t main()
{
    int n;cin>>n;
    int a[2*n];rep(i,2*n)cin>>a[i];
    sort(a,a+2*n);
    rep(i,2*n){
        if(a[i] == a[i-1] && i>0){
            cout<<"NO"<<"\n";
            return 0;
        }
    }
    cout<<"YES"<<"\n";
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long int
#define pii pair<int, int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define mii map<int, int>
#define MAX 2000002
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcount(x)
#define zrobits(x) __builtin_ctz(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define FIO                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

/*void sieve(int p[],int n)
            {
                for(int i=3;i<=n;i+=2)
                {
                    p[i]=1;
                }
                //Sieve
                for(int i=3;i<=n;i++)
                {
                    if(p[i] == 1)
                    {
                        for(int j=i*i;j<=n;j+=i)
                        {
                            p[j]=0;
                        }
                    }
                }
                p[2]=1;
                p[0]=p[1]=0;
            }*/

int recpow(int x, int n)
{
    if (n == 0)
        return 1;
    else if (n % 2 == 0) //n is even
        return recpow((x * x), n / 2);
    else //n is odd
        return (x * recpow((x * x), (n - 1) / 2));
}

/*int modInverse(int n, int p)
            {
                return recpow(n, p - 2);
            }

            int nCrModPFermat(int n, int r)
            {
                if (r == 0)
                    return 1;
                int fac[n + 1];
                fac[0] = 1;
                for (int i = 1; i <= n; i++)
                    fac[i] = fac[i - 1] * i % M;

                return (fac[n] * modInverse(fac[r], M) % M * modInverse(fac[n - r], M) % M) % M;
            }*/

int32_t main()
{
    int n;cin>>n;
    int a[2*n];rep(i,2*n)cin>>a[i];
    sort(a,a+2*n);
    if(a[n] == a[n-1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


// __   _   _   _   _____   _   _   _____   _   _       ___
//|  \ | | | | | | /  ___| | | | | /  ___/ | | | |     /   |
//|   \| | | | | | | |     | | | | | |___  | |_| |    / /| |
//| |\   | | | | | | |  _  | | | | \___  \ |  _  |   / / | |
//| | \  | | |_| | | |_| | | |_| |  ___| | | | | |  / /  | |
//|_|  \_| \_____/ \_____/ \_____/ /_____/ |_| |_| /_/   |_|

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<ctype.h>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<iomanip>
#include<vector>
#include<map>
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)
#define ff first
#define ss second
#define ll long long
#define pii pair< int, int >
#define MEM(p, v) memset(p, v, sizeof(p))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define INF int(1e9)
#define MAX_5 int(1e5+5)
#define MAX_6 int(1e6+6)
#define ll long long
#define tree int h,int l1,int r1
#define left 2*h,l1,(l1+r1)/2
#define right 2*h+1,(l1+r1)/2+1,r1
using namespace std;
int a[MAX_5],g[MAX_5*5],i,m,ans,k,l,j,q,x,n,ma,mi,LL,r,L,R,ls,s,mid,FF;
struct aa{
    int mi,ma;
}v[MAX_5*5];
int gomax(tree)
{
    if(l>r1 || r<l1 || l1>r1)return -int(1e9);
    if(l<=l1 && r1<=r)return v[h].ma;
    return max(gomax(left),gomax(right));
}
int gomin(tree)
{
    if(l>r1 || r<l1 || l1>r1)return int(1e9);
    if(l<=l1 && r1<=r)return v[h].mi;
    return min(gomin(left),gomin(right));
}
void build(tree)
{
    if(l1==r1){v[h].ma=v[h].mi=a[l1];g[h]=int(1e9);return;}
    build(left);
    build(right);
    v[h].ma=max(v[h*2].ma,v[h*2+1].ma);
    v[h].mi=min(v[h*2].mi,v[h*2+1].mi);
    g[h]=min(g[h*2],g[h*2+1]);
}
int go1min(tree)
{
    if(l>r1 || r<l1 || l1>r1)return int(1e9+7);
    if(l<=l1 && r1<=r)return g[h];
    return min(go1min(left),go1min(right));
}
void upd(tree)
{
    if(l>r1 || r<l1 || l1>r1)return ;
    if(l1==r1){g[h]=ans+1;return;}
    upd(left);
    upd(right);
    g[h]=min(g[h*2],g[h*2+1]);
}
main()
{
          cin>>n>>s>>LL;
          for(i=1;i<=n;i++)cin>>a[i];
          build(1,1,n);

          for(i=1;i<=n;i++)
          {

            L=1;R=i-LL+1;ls=-1;
            while(L<=R)
            {
                mid=L+R;mid/=2;

                l=mid;r=i;
                if(gomax(1,1,n)>gomin(1,1,n)+s)L=mid+1;else R=mid-1,ls=mid;
            }
 //             cout<<i<<" <---"<<endl;

            if(ls==-1)
            {
                ans=int(1e9);
                l=r=i;
                upd(1,1,n);
                continue;
            }

            l=ls-1;r=i-LL;ans=int(1e9);

            if(l>r)
            {
                ans=int(1e9);
                l=r=i;
                upd(1,1,n);
                continue;
            }

            if(i==5)FF=1;else FF=0;
//              cout<<i<<" "<<ans<<" "<<ls<<" "<<l<<" "<<r<<endl;
            if(l==0)ans=0;else ans=go1min(1,1,n);
//              cout<<i<<" "<<ans<<" "<<ls<<" "<<l<<" "<<r<<endl;
            FF=0;

            l=r=i;
//          cout<<i<<" "<<ans<<endl;
            upd(1,1,n);
          }

          ans++;
          if(ans>=int(1e9))ans=-1;
          cout<<ans<<endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <class T>
using ordered_set =
       tree <T,null_type,less <T>,rb_tree_tag,tree_order_statistics_node_update> ;
///find_by_order()
///order_of_key()

template <class T,class U>
void maximize(T &x,U y)
{
    if(x < y)x=y;
}
template <class T,class U>
void minimize(T &x,U y)
{
    if(x > y)x=y;
}
template <class T>
T Abs(T x)
{
    return (x < (T)0 ? -x : x);
}
template <class T>
T safe_sqrt(T x)
{
    return sqrt(max(x,(T)0));
}
template <class T,class U,class V>
T addmod(T x,U k,V MOD)
{
    return ((x+k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T submod(T x,U k,V MOD)
{
    return ((x-k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T mul(T x,U y,V MOD)
{
    return (long long)x*y%MOD;
}

#define ll long long
#define pll pair <ll,ll>
#define pii pair <int,int>
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define MASK(i) ((1LL)<<(i))
#define BIT(x,i) (((x)>>(i))&1)
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)((c).size())
#define fn "test"    ///FILE_NAME_HERE

/*------------------------------------------END_OF_TEMPLATE------------------------------------------*/

namespace task{

const int N=1e5+5;
const int lg = 18;
const int inf = 1e9;
int rmq[2][N][lg + 2],a[N],f[N];
int n,s,l;

void solve()
{
    cin>>n>>s>>l;
    for(int i = 1;i <= n;++i)
        cin>>a[i];
    for(int i = 1;i <= n;++i)
        rmq[0][i][0] = rmq[1][i][0] = a[i];
    for(int j = 1;j <= lg;++j)
        for(int i = 1;i <= n - MASK(j) + 1;++i)
    {
        rmq[0][i][j] = max(rmq[0][i][j - 1],rmq[0][i + MASK(j - 1)][j - 1]);
        rmq[1][i][j] = min(rmq[1][i][j - 1],rmq[1][i + MASK(j - 1)][j - 1]);
    }
    f[n + 1] = 0;
    fill(f + 1,f + 1 + n,inf);
    deque <int> dq;
    for(int i = n;i >= 1;--i)
    {
        int lift = i,maxVal = -inf,minVal = inf;
        for(int j = lg;j >= 0;--j)
            if(lift + MASK(j) <= n + 1 and max(maxVal,rmq[0][lift][j]) - min(minVal,rmq[1][lift][j]) <= s)
              maximize(maxVal,rmq[0][lift][j]),minimize(minVal,rmq[1][lift][j]),lift += MASK(j);
        if(i + l <= n + 1 and f[i + l] != inf)
        {
            while(!dq.empty() and f[dq.back()] >= f[i + l])
                dq.pop_back();
            dq.push_back(i + l);
        }
        while(!dq.empty() and dq.front() > lift)
            dq.pop_front();
        if(!dq.empty())
            f[i] = f[dq.front()] + 1;
    }
    cout<<(f[1] == inf ? -1 : f[1]);
}}

int main(void)
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen(fn".inp","r",stdin);
    freopen(fn".out","w",stdout);
    #endif // ONLINE_JUDGE
    task::solve();
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 3, B = 17, INF = 1e7;

int n, s, l, a[N], minv[B][N], maxv[B][N], dp[N];

void process() {
	memcpy(minv[0], a, sizeof(a));
	memcpy(maxv[0], a, sizeof(a));
	for (int b = 1; b < B; b++) {
		for (int i = 1; i + (1 << b) -1 <= n; i++) {
			minv[b][i] = min(minv[b - 1][i], minv[b - 1][i + (1 << (b - 1))]);
			maxv[b][i] = max(maxv[b - 1][i], maxv[b - 1][i + (1 << (b - 1))]);
		}
	}
}

int main() {
	scanf("%d%d%d", &n, &s, &l);
	for (int i = 1; i <= n; i++)
		scanf("%d", a + i);
	process();
	fill(dp + 1, dp + n + 1, INF);
	deque<int> deq; deq.push_back(0);
	for (int i = l; i <= n; i++) {
		int j = i, m1 = a[i], m2 = a[i];
		for (int b = B - 1; b >= 0; b--) {
			if (j - (1 << b) >= 0) {
				if (max(m2, maxv[b][j - (1 << b) + 1]) -
					min(m1, minv[b][j - (1 << b) + 1]) <= s){
					m2 = max(m2, maxv[b][j - (1 << b) + 1]);
					m1 = min(m1, minv[b][j - (1 << b) + 1]);
					j -= 1 << b;
				}
			}
		}
		j++;
		if (j <= i - l + 1) {
			while (!deq.empty() && deq.front() < j - 1)
				deq.pop_front();
			if (!deq.empty())
				dp[i] = min(dp[i], 1 + dp[deq.front()]);
		}
		while (!deq.empty() && dp[deq.back()] >= dp[i - l + 1])
			deq.pop_back();
		deq.push_back(i - l + 1);
	}
	if (dp[n] < INF)
		printf("%d\n", dp[n]);
	else
		puts("-1");
}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             5e13
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define all(a)          a.begin(),a.end()
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
const int N = 100005;

int valid[N],ara[N];
int n,s,sz;
int tree[4*N];

void update(int at,int L,int R,int pos,int val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    int mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=min(tree[2*at],tree[2*at+1]);
}

int query(int at,int L,int R,int l,int r)
{
    if(r<L or R<l)return 1e9;
    if(l<=L and R<=r)return tree[at];

    int mid = (L+R)/2;
    int x = query(2*at,L,mid,l,r);
    int y = query(2*at+1,mid+1,R,l,r);

    return min(x,y);
}

multiset<int>st;

int main()
{
    FastRead
    cin >> n >> s >> sz;
    FOR(i,1,n)cin >> ara[i] , valid[i] = -1;

    int l = 1,r = 0;
    while(l <= n)
    {
        int mn = ara[r+1],mx = ara[r+1];
        if(!st.empty()){
            mn = min(mn,*st.begin());
            mx = max(mx,*st.rbegin());
        }

        if((r + 1 <= n and (mx-mn) <= s)){
            r++;
            st.insert(ara[r]);
        }else{
            valid[l] = r ;
            st.erase(st.find(ara[l]));
            l++;
        }
    }
    update(1,1,n +1 ,n + 1,0);
    for(int i = n;i>=1;i--){
        int l = i + sz - 1 + 1;
        int r = valid[i] + 1;
        int v = query(1,1,n + 1,l,r);
//        cout << l << " " << r << " " << " in " << i << " " << v << endl;
         update(1,1,n + 1,i,v + 1);
    }
    int ans = query(1,1,n + 1,1,1);
    if(ans == 0 or ans >=1e9)ans = -1;
    cout << ans << " ";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3;

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	multiset<int> st;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		st.insert(a[j]);
		while (st.size() && *(--st.end()) - *st.begin() > s) {
			st.erase(st.find(a[i]));
			++i;
		}
		best[j] = i;
	}
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = 1e9;
		int newL = best[i], newR = i - l + 1;
 		for (int j = newL; j <= newR; ++j) {
 		    if (dp[j - 1] < 1e9) {
 		        dp[i] = dp[j - 1] + 1;
                break;
 		    }
 // 			dp[i] = min(dp[i], dp[j - 1] + 1);
 		}
	}
	if (dp[n] < 1e9)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3;

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	multiset<int> st;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		st.insert(a[j]);
		while (st.size() && *(--st.end()) - *st.begin() > s) {
			st.erase(st.find(a[i]));
			++i;
		}
		best[j] = i;
	}
	dp[0] = 0;
	int prv = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = 1e9;
		int newL = best[i], newR = i - l + 1;
		for (int j = max(prv, newL); j <= newR; ++j) {
			if (dp[j - 1] + 1 <= dp[i]) {
				dp[i] = dp[j - 1] + 1;
				prv = j;
			}
		}
	}
	if (dp[n] < 1e9)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3, OO = 1e9;

struct monotonic_queue {
	stack<pair<int, pair<int, int>>> s1, s2;
	monotonic_queue() {
		s1.push({0, {OO, -OO}});
		s2.push({0, {OO, -OO}});
	}
	int size() {
		return s1.size() + s2.size() - 2;
	}
	void moveit() {
		while (s1.size() > 1) {
			int v = s1.top().first;
			s2.push({v, {min(v, s2.top().second.first), max(v, s2.top().second.second)}});
			s1.pop();
		}
	}
	void push(int v) {
		s1.push({v, {min(v, s1.top().second.first), max(v, s1.top().second.second)}});
	}
	void pop() {
		if (s2.size() > 1) {
			s2.pop();
			return;
		}
		moveit();
		if (s2.size() == 1)
			return;
		s2.pop();
	}
	int top() {
		if (s2.size() > 1)
			return s2.top().first;
		moveit();
		return s2.top().first;
	}
	int get_min() {
		return min(s1.top().second.first, s2.top().second.first);
	}
	int get_max() {
		return max(s1.top().second.second, s2.top().second.second);
	}
	void clear() {
		stack<pair<int, pair<int, int>>>().swap(s1);
		stack<pair<int, pair<int, int>>>().swap(s2);
		s1.push({0, {OO, -OO}});
		s2.push({0, {OO, -OO}});
	}
};

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	monotonic_queue q;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		q.push(a[j]);
		while (q.size() && q.get_max() - q.get_min() > s) {
			q.pop();
			++i;
		}
		best[j] = i;
	}
	q.clear();
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = OO;
		int newL = best[i], newR = i - l + 1;
		if (newR >= 1)
			q.push(dp[newR - 1]);
		while (left < newL && left <= newR) {
			q.pop();
			++left;
		}
		dp[i] = q.get_min() + 1;
	}
	if (dp[n] < OO)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3, OO = 1e9;

struct monotonic_queue {
	// incomplete implementation
	stack<pair<int, pair<int, int>>> s1, s2;
	monotonic_queue() {
		s1.push({0, {OO, -OO}});
		s2.push({0, {OO, -OO}});
	}
	int size() {
		return s1.size() + s2.size() - 2;
	}
	void moveit() {
		while (s1.size() > 1) {
			int v = s1.top().first;
			s2.push({v, {min(v, s2.top().second.first), max(v, s2.top().second.second)}});
			s1.pop();
		}
	}
	void push(int v) {
		s1.push({v, {min(v, s1.top().second.first), max(v, s1.top().second.second)}});
	}
	void pop() {
		if (s2.size() > 1) {
			s2.pop();
			return;
		}
		moveit();
		if (s2.size() == 1)
			return;
		s2.pop();
	}
	int top() {
		if (s2.size() > 1)
			return s2.top().first;
		moveit();
		return s2.top().first;
	}
	int get_min() {
		return min(s1.top().second.first, s2.top().second.first);
	}
	int get_max() {
		return max(s1.top().second.second, s2.top().second.second);
	}
	void clear() {
		stack<pair<int, pair<int, int>>>().swap(s1);
		stack<pair<int, pair<int, int>>>().swap(s2);
		s1.push({0, {OO, -OO}});
		s2.push({0, {OO, -OO}});
	}
};

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	monotonic_queue q;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		q.push(a[j]);
		while (q.size() && q.get_max() - q.get_min() > s) {
			q.pop();
			++i;
		}
		best[j] = i;
	}
	q.clear();
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = OO;
		int newL = best[i], newR = i - l + 1;
		if (newR >= 1) {
			q.push(dp[newR - 1]);
		}
		while (left < newL) {
			q.pop();
			++left;
		}
		dp[i] = q.get_min() + 1;
	}
	if (dp[n] < OO)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3;

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	multiset<int> st;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		st.insert(a[j]);
		while (st.size() && *(--st.end()) - *st.begin() > s) {
			st.erase(st.find(a[i]));
			++i;
		}
		best[j] = i;
	}

	st.clear();
	st.insert(1e9);
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = 1e9;
		int newL = best[i], newR = i - l + 1;
		if (newR >= 1)
			st.insert(dp[newR - 1]);
		while (left < newL && left <= newR) {
			st.erase(st.find(dp[left - 1]));
			++left;
		}
		dp[i] = *st.begin() + 1;
	}
	if (dp[n] < 1e9)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3;

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	multiset<int> st;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		st.insert(a[j]);
		while (st.size() && *(--st.end()) - *st.begin() > s) {
			st.erase(st.find(a[i]));
			++i;
		}
		best[j] = i;
	}

	st.clear();
	st.insert(1e9);
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = 1e9;
		int newL = best[i], newR = i - l + 1;
		if (newR >= 1)
			st.insert(dp[newR - 1]);
		while (left < newL) {
			st.erase(st.find(dp[left - 1]));
			++left;
		}
		dp[i] = *st.begin() + 1;
	}
	if (dp[n] < 1e9)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N = 1e5 + 3;

int n, s, l, a[N], dp[N], best[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
//	freopen("output.out", "wt", stdout);
#endif
	scanf("%d %d %d", &n, &s, &l);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	multiset<int> st;
	int i = 1;
	for (int j = 1; j <= n; ++j) {
		st.insert(a[j]);
		while (st.size() && *(--st.end()) - *st.begin() > s) {
			st.erase(st.find(a[i]));
			++i;
		}
		best[j] = i;
	}
	dp[0] = 0;
	int left = 1;
	for (i = 1; i <= n; ++i) {
		dp[i] = 1e9;
		int newL = best[i], newR = i - l + 1;
		for (int j = newL; j <= newR; ++j)
			dp[i] = min(dp[i], dp[j - 1] + 1);
	}
	if (dp[n] < 1e9)
		printf("%d\n", dp[n]);
	else
		puts("-1");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

template<class T>
class monotonic_queue {
	struct node {
		T val, min, max;

		inline node(T v = 0) {
			val = min = max = v;
		}
	};

	stack<node> s1, s2;

	inline void flip() {
		while (!s1.empty()) {
			node n(s1.top().val);
			if (!s2.empty()) {
				n.min = std::min(n.min, s2.top().min);
				n.max = std::max(n.max, s2.top().max);
			}
			s1.pop();
			s2.push(n);
		}
	}

public:
	inline void push(int val) {
		node n(val);
		if (!s1.empty()) {
			n.min = std::min(n.min, s1.top().min);
			n.max = std::max(n.max, s1.top().max);
		}
		s1.push(n);
	}

	inline void pop() {
		if (s2.empty() == 1) flip();
		if (s2.empty() == 0) s2.pop();
	}

	inline T min() const {
		T mn = 2e9;
		if (!s1.empty()) mn = std::min(mn, s1.top().min);
		if (!s2.empty()) mn = std::min(mn, s2.top().min);
		return mn;
	}

	inline T max() const {
		T mx = -2e9;
		if (!s1.empty()) mx = std::max(mx, s1.top().max);
		if (!s2.empty()) mx = std::max(mx, s2.top().max);
		return mx;
	}

	inline int size() const {
		return s1.size() + s2.size();
	}
};

int n, s, l, i, k, ans, a[100001]; monotonic_queue<int> q;

int main() {
	cin >> n >> s >> l;
	for (i = 0; i < n; ++i) {
		scanf("%d", a + i);
	}

	ans = i = 1;
	q.push(a[0]);

	while (i < n) {
		while (i < n && q.max() - q.min() <= s) {
			q.push(a[i++]);
		}

		if (q.max() - q.min() <= s) {
			break;
		}
		if (q.size() - 1 < l) {
			return cout << -1, 0;
		}

		ans++;

		for (k = 0; k < l; ++k) {
			q.pop();
		}
		while (q.size() > 0 && q.max() - q.min() > s) {
			q.pop();
		}
	}

	cout << (q.size() < l ? -1 : ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 100001;
const int oo = 1e9;

int n, s, l, a[N], ST[N][20][2], LOG[N], dp[N];

inline void buildST() {
	int x, y, i, j;

	for (i = 0, LOG[0] = -1; i < n; ++i) {
		ST[i][0][0] = ST[i][0][1] = a[i];
		LOG[i + 1] = LOG[i] + !(i & (i + 1));
	}

	for (j = 1; (1 << j) <= n; ++j) {
		for (i = 0; (i + (1 << j)) <= n; ++i) {
			x = ST[i][j - 1][0];
			y = ST[i + (1 << (j - 1))][j - 1][0];
			ST[i][j][0] = min(x, y);

			x = ST[i][j - 1][1];
			y = ST[i + (1 << (j - 1))][j - 1][1];
			ST[i][j][1] = max(x, y);
		}
	}
}

inline int getMaxDiff(int l, int r) {
	int g = LOG[r - l + 1];
	r = r - (1 << g) + 1;
	return max(ST[l][g][1], ST[r][g][1]) - min(ST[l][g][0], ST[r][g][0]);
}

inline int solve() {
	deque<int> q;
	q.push_back(n);

	for (int i = n - 1; i >= 0; --i) {
		while (!q.empty() && getMaxDiff(i, q.front() - 1) > s) {
			q.pop_front();
		}

		if (q.empty() || q.front() - i < l) {
			dp[i] = oo;
			continue;
		}

		dp[i] = dp[q.front()] + 1;
		q.push_back(i);
	}

	return (dp[0] >= oo) ? -1 : dp[0];
}

int main() {
	cin >> n >> s >> l;
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
	}
	buildST();
	cout << solve() << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=100004;
int a[N];
int n,d,l;
int solve(int s)
{
    if(s>=n)
        return 0;
    int mnval=a[s];
    int mxval=a[s];
    int e,i;
    for( i=s+1;i<n;i++)
    {
        if(a[i]<mnval)
        {
            if(mxval-a[i]>d)
                break;
            mnval=a[i];
        }
        else if(a[i]>mxval)
        {
            if(a[i]-mnval>d)
                break;
            mxval=a[i];
        }
    }
    e=i;
    if(e-s<l)
        return -1;
    int res;
    for( i=e;i>=s+l;i--)
    {
            res=solve(i);
            if(res>=0)
                return res+1;
    }
    return -1;
}
int main()
{
    scanf("%d %d %d",&n,&d,&l);
    int i;
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    int ans=solve(0);
    printf("%d\n",ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define pii pair<int, int>

/* Segment Tree: Single element modification, range query */
class Segment_Tree_SR {
	vector<int> t;
	int n;
	int default_val;
	int (*combine)(int, int);
public:
	Segment_Tree_SR(vector<int> a, int (*f) (int, int), int init_val) {
		n = a.size();
		default_val = init_val;
		combine = f;
		t.resize(2*n);
		for (int i=1; i<2*n; i++) t[i] = default_val;
		for (int i=0; i<n; i++) t[i+n] = a[i];
		for (int i=n-1; i>=1; i--) t[i] = combine(t[i<<1], t[i<<1 | 1]);
	}
	void modify(int pos, int val) {
		for (t[pos+=n] = val; pos > 1; pos>>=1)
			t[pos>>1] = combine(t[pos], t[pos^1]); // parent = combine(this cell, neighbor cell)
	}
	int query(int l, int r) { // Query the range [l, r)
		int res = default_val;
		for (l+=n, r+=n; l < r; l>>=1, r>>=1) {
			if (l & 1) res = combine(res, t[l++]);
			if (r & 1) res = combine(res, t[--r]);
		}
		return res;
	}
};

Segment_Tree_SR* min_tree, *max_tree, *solution_tree;
const int INF = 1e9 + 5;
const int MXN = 1e5 + 5;
int n, s, l, a[MXN], dp[MXN];

int solve(int pos) {
	if (pos >= n) return dp[pos] = 0;
	if (dp[pos] != -1) return dp[pos];
	if (pos + l > n) return dp[pos] = INF;
	int lo = pos, hi = n-1, mid;
	while (lo < hi - 1) {
		mid = lo + hi >> 1;
		int minim = min_tree->query(pos, mid + 1);
		int maxim = max_tree->query(pos, mid + 1);
		if (maxim - minim > s) hi = mid - 1;
		else lo = mid;
	}
	int furthest = 0;
	int minim = min_tree->query(pos, hi + 1);
	int maxim = max_tree->query(pos, hi + 1);
	if (maxim - minim <= s) furthest = hi;
	else furthest = lo;
	if (furthest - pos + 1 >= l) {
		return dp[pos] = 1 + solution_tree->query(pos + l, furthest + 2);
	}
	return dp[pos] = INF;
}

int min(int a, int b) { if (a < b) return a; return b; }
int max(int a, int b) { if (a > b) return a; return b; }

int main () {
	ios_base::sync_with_stdio(false);
	memset(dp, -1, sizeof(dp));
	cin>>n>>s>>l;
	for (int i=0; i<n; i++) cin>>a[i];
	vector<int> v1(a, a+n);
	vector<int> v2(a, a+n);
	v1.push_back(INF);
	v2.push_back(-INF);
	min_tree = new Segment_Tree_SR(v1, min, INF);
	max_tree = new Segment_Tree_SR(v2, max, -INF);
	solution_tree = new Segment_Tree_SR(vector<int>(n + 1, INF), min, INF);
	for (int i=n; i>=0; i--) solution_tree->modify(i, solve(i));
	int res = dp[0];
	if (res >= INF) cout<<-1<<endl;
	else cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define li 100005
#define ii pair<int,int>
#define fi first
#define se second
#define mid ((l+r)/2)
#define inf 1000000005
using namespace std;
int n,s,l,A[li],dp[li],tree2[li];
ii tree[li*4];
void build(int node,int l,int r){
    if(l==r){
        tree[node].fi=A[l];
        tree[node].se=A[l];
        return ;
    }
    build(node*2,l,mid),build(node*2+1,mid+1,r);
    tree[node].fi=min(tree[node*2].fi,tree[node*2+1].fi);
    tree[node].se=max(tree[node*2].se,tree[node*2+1].se);
}
ii get(int node,int l,int r,int gl,int gr){
    ii re;
    re.fi=inf;
    re.se=-inf;
    if(l>gr || r<gl) return re;
    if(l>=gl && r<=gr) return tree[node];
    ii sol=get(node*2,l,mid,gl,gr);
    ii sag=get(node*2+1,mid+1,r,gl,gr);
    re.fi=min(sol.fi,sag.fi);
    re.se=max(sol.se,sag.se);
    return re;
}
int solve(int bas,int son){
    int ind=son;
    while(bas<=son){
        int orta=(bas+son)/2;
        ii k=get(1,1,n,orta,ind);
        if(k.se-k.fi<=s) son=orta-1;
        else bas=orta+1;
    }
    return bas;
}
int get2(int node,int l,int r,int gl,int gr){
    if(l>gr || r<gl || gl>gr) return inf;
    if(gl==0) return 0;
    if(l>=gl && r<=gr) return tree2[node];
    return min(get2(node*2,l,mid,gl,gr),get2(node*2+1,mid+1,r,gl,gr));
}
int update(int node,int l,int r,int a){
    if(l>a || r<a) return tree2[node];
    if(l==a && r==a) return tree2[node]=dp[a];
    return tree2[node]=min(update(node*2,l,mid,a),update(node*2+1,mid+1,r,a));
}
int main(){
    scanf("%d %d %d",&n,&s,&l);
    for(int i=1;i<=n;i++) scanf("%d",&A[i]);
    build(1,1,n);
    for(int i=1;i<=n;i++){
        dp[i]=get2(1,1,n,solve(1,i)-1,i-l)+1;
        update(1,1,n,i);
    }
    if(dp[n]>=inf) printf("-1");
    else printf("%d",dp[n]);
    return 0;
}


#include <bits/stdc++.h>
#define li 100005
#define ii pair<int,int>
#define fi first
#define se second
#define mid ((l+r)/2)
#define inf 1000000005
using namespace std;
int n,s,l,A[li],dp[li],tree2[li];
ii tree[li*4];
void build(int node,int l,int r){
    if(l==r){
        tree[node].fi=A[l];
        tree[node].se=A[l];
        return ;
    }
    build(node*2,l,mid),build(node*2+1,mid+1,r);
    tree[node].fi=min(tree[node*2].fi,tree[node*2+1].fi);
    tree[node].se=max(tree[node*2].se,tree[node*2+1].se);
}
ii get(int node,int l,int r,int gl,int gr){
    ii re;
    re.fi=inf;
    re.se=-inf;
    if(l>gr || r<gl) return re;
    if(l>=gl && r<=gr) return tree[node];
    ii sol=get(node*2,l,mid,gl,gr);
    ii sag=get(node*2+1,mid+1,r,gl,gr);
    re.fi=min(sol.fi,sag.fi);
    re.se=max(sol.se,sag.se);
    return re;
}
int solve(int bas,int son){
    int ind=son;
    while(bas<son){
        int orta=(bas+son)/2;
        ii k=get(1,1,n,orta,ind);
        if(k.se-k.fi<=s) son=orta;
        else bas=orta+1;
    }
    return bas;
}
int get2(int node,int l,int r,int gl,int gr){
    if(l>gr || r<gl || gl>gr) return inf;
    if(gl==0) return 0;
    if(l>=gl && r<=gr) return tree2[node];
    return min(get2(node*2,l,mid,gl,gr),get2(node*2+1,mid+1,r,gl,gr));
}
int update(int node,int l,int r,int a){
    if(l>a || r<a) return tree2[node];
    if(l==a && r==a) return tree2[node]=dp[a];
    return tree2[node]=min(update(node*2,l,mid,a),update(node*2+1,mid+1,r,a));
}
int main(){
    scanf("%d %d %d",&n,&s,&l);
    for(int i=1;i<=n;i++) scanf("%d",&A[i]);
    build(1,1,n);
    for(int i=1;i<=n;i++){
        dp[i]=get2(1,1,n,solve(1,i)-1,i-l)+1;
        update(1,1,n,i);
    }
    if(dp[n]>=inf) printf("-1");
    else printf("%d",dp[n]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define len(s) (int)s.size()
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define mod 1e9+7
#define inf 1000000005
#define limit 100005
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define d1(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define d2(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define d3(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" = "<<z;
#define GG {printf("-1"); return 0;}
#define y1 asdas
#define ll long long
pair <int,int> tree[limit*3];
int n,s,l,ar[limit],tree2[limit*3],dp[limit];
void build(int ind,int x,int y)
{
	if(x==y)
	{
		tree[ind].fi=tree[ind].sc=ar[x];
		return;
	}
	build(ind+ind,x,(x+y)/2);
	build(ind+ind+1,(x+y)/2+1,y);
	tree[ind].fi=min(tree[ind+ind].fi,tree[ind+ind+1].fi);
	tree[ind].sc=max(tree[ind+ind].sc,tree[ind+ind+1].sc);
}
pair<int,int> get(int ind,int x,int y,int xw,int yw)
{
	pair<int,int> re;
	re.fi=inf;
	re.sc=-inf;
	if(x>=xw && y<=yw) return tree[ind];
	if(x>yw || y<xw) return re;
	pair<int,int> sol=get(ind+ind,x,(x+y)/2,xw,yw);
	pair<int,int> sag=get(ind+ind+1,(x+y)/2+1,y,xw,yw);
	re.fi=min(sol.fi,sag.fi);
	re.sc=max(sol.sc,sag.sc);
	return re;
}
int get2(int ind,int x,int y,int xw,int yw)
{
	if(xw>yw) return inf;
	if(xw==0) return 0;
	if(x>yw || y<xw) return inf;
	if(x>=xw && y<=yw) return tree2[ind];
	return min(get2(ind+ind,x,(x+y)/2,xw,yw),get2(ind+ind+1,(x+y)/2+1,y,xw,yw));
}
int solve(int bas,int son)
{
	int ind=son;
	while(bas<son)
	{
		pair<int,int> k=get(1,1,n,(bas+son)/2,ind);
		if(k.sc-k.fi<=s) son=(bas+son)/2;
		else bas=(bas+son)/2+1;
	}
	return bas;
}
int update(int ind,int x,int y,int a)
{
	if(x>a || y<a) return tree2[ind];
    if(x==a && x==y) return tree2[ind]=dp[a];
    return tree2[ind]=min(update(ind+ind,x,(x+y)/2,a),update(ind+ind+1,(x+y)/2+1,y,a));
}
int main()
{
	scanf("%d %d %d",&n,&s,&l);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ar[i]);
	}
	build(1,1,n);
	for(int i=1;i<=n;i++)
	{
		dp[i]=get2(1,1,n,solve(1,i)-1,i-l)+1;
		update(1,1,n,i);
	}
	if(dp[n]>=inf) GG;
	printf("%d\n",dp[n]);
}


/// !! Killian !! ///

#include <bits/stdc++.h>
#define Killian "488D"
#define endl "\n"
#define pii pair <int,int>
#define bit(mask,x) (((mask)>>(x))&1)
using namespace std;
mt19937_64 random_num(chrono::high_resolution_clock::now().time_since_epoch().count());
const int MOD=1000000007;
const int base=26;

int n,s,l;
int a[100005];
struct data
{
    int val,pos;
};
deque <data> mx,mn,dp;
int f[100005];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen(Killian".inp","r",stdin);
//    freopen(Killian".out","w",stdout);
    cin>>n>>s>>l;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i];
        f[i]=1e6;
    }
    f[0]=0;
    int it=0;
    for (int i=1; i<=n; i++)
    {
        while (mx.empty()==0 && mx.back().val<=a[i])
            mx.pop_back();
        mx.push_back({a[i],i});
        while (mn.empty()==0 && mn.back().val>=a[i])
            mn.pop_back();
        mn.push_back({a[i],i});
        if (i>=l)
        {
            while (dp.empty()==0 && dp.back().val>f[i-l])
                dp.pop_back();
            dp.push_back({f[i-l],i-l});
        }
        while (mx.empty()==0 && mn.empty()==0 && mx.front().val-mn.front().val>s)
        {
            it++;
            while (mx.empty()==0 && mx.front().pos<it)
                mx.pop_front();
            while (mn.empty()==0 && mn.front().pos<it)
                mn.pop_front();
        }
        while(dp.size() && dp.front().pos<it-1)
            dp.pop_front();
        if (dp.empty()==0)
            f[i]=dp.front().val+1;
    }
    if (f[n]<=n)
        cout<<f[n];
    else
        cout<<-1;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if((1<<i) <= x + 1)
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	/*for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);*/
	for(int i = l; i <= r; i++)
		minn = min(minn, dp[i]);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i];
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1)
		return cout << 1, 0;
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		//cout << i << " " << high << " " ;
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		//cout << dp[i] << endl;
		//up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if((1<<i) <= x + 1)
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i];
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1)
		return cout << 1, 0;
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		//cout << i << " " << high << " " ;
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		//cout << dp[i] << endl;
		up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if(x - (1<<(i - 1)) < 0)
			mn[i][x] = mn[i - 1][x];
		else
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i], mn[0][i] = 1e6;
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1){
		if(l == 1)
			return cout << 1, 0;
		return cout << -1, 0;
	}
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if(x - (1<<(i - 1)) < 0)
			mn[i][x] = mn[i - 1][x];
		else
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i], mn[0][i] = 1e6;
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1)
		return cout << 1, 0;
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if(x - (1<<(i - 1)) < 0){
			mn[i][x] = mn[i - 1][x];
		}
		else
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i];
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1)
		return cout << 1, 0;
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
using namespace std ;
typedef long long ll;
typedef pair<int,int> pii;

const ll maxn = 1e5 + 1;
const ll INF = 4e18 ;
const int lg = 19;

int n, k, l, s, dp[maxn], a[maxn];
int high, low, mid;
int mxa[lg][maxn];
int mna[lg][maxn];
int mn[lg][maxn];

void up(int x){
	mn[0][x] = dp[x];
	for(int i = 1; i < lg; i++)
		if((1<<i) <= x + 1)
			mn[i][x] = min(mn[i - 1][x], mn[i - 1][x - (1<<(i - 1))]);
}

int mndp(int l, int r){
	int h = r - l + 1, minn = 1e6 + 1;
	if(l < 0)
		return 0;
	if(l > r)
		return minn;
	/*for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mn[i][r]), r -= (1<<i);*/
	for(int i = l; i <= r; i++)
		minn = min(minn, dp[i]);
	return minn;
}

int mnq(int l, int r){
	int h = r - l + 1, minn = 1e9 + 1;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			minn = min(minn, mna[i][l]), l += (1<<i);
	return minn;
}

int mxq(int l, int r){
	int h = r - l + 1, maxx = -1e9 - 5;
	for(int i = 0; i < lg; i++)
		if((1<<i) & h)
			maxx = max(maxx, mxa[i][l]), l += (1<<i);
	return maxx;
}

bool check(int l, int r){
	if(mxq(l, r) - mnq(l, r) <= s)
		return 1;
	return 0;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> l;
	for(int i = 0; i < n; i++)
		cin >> a[i], mna[0][i] = mxa[0][i] = a[i];
	for(int i = 1; i < lg; i++)
		for(int j = 0; j < n; j++){
			mn[i][j] = 1e6;
			mna[i][j] = min(mna[i - 1][j], mna[i - 1][j + (1<<(i - 1))]);
			mxa[i][j] = max(mxa[i - 1][j], mxa[i - 1][j + (1<<(i - 1))]);
		}
	fill(dp, dp + maxn, 1e6);
	if(n == 1){
		if(l == 1)
			return cout << 1, 0;
		return cout << -1, 0;
	}
	if(l == 1)
		dp[0] = 1, up(0);
	for(int i = 1; i < n; i++){
		low = -1, high = i - l + 2, mid = 0;
		if(i + 1 < l)
			continue;
		while(high - low > 1){
			mid = (high + low) / 2;
			if(check(mid, i))
				high = mid;
			else
				low = mid;
		}
		//cout << i << " " << high << " " ;
		dp[i] = min(dp[i], mndp(high - 1, i - l) + 1);
		//cout << dp[i] << endl;
		//up(i);
	}
	if(dp[n - 1] == 1e6)
		cout << -1;
	else
 		cout << dp[n - 1];
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int Arr[100005];
int seg[400002][2];
int segdp[400002];
int dp[100005];
void build(int id,int l,int r) {
if(l==r) {
        seg[id][0] = seg[id][1]  = Arr[l];
        return;
}
int mid=  (l+r)/2;
build(id*2,l,mid);
build(id*2+1,mid+1,r);
seg[id][0] = min(seg[id*2][0],seg[id*2+1][0]);
seg[id][1] = max(seg[id*2][1],seg[id*2+1][1]);
}
int qu(int id,int l,int r,int x,int y,int s) {
if(l > y || r <x) return (s) ? INT_MAX : -INT_MAX;
if(l >=x && r<=y)  return (s) ? seg[id][0] : seg[id][1];
int mid = (l+r)/2;
return (s) ? min(qu(id*2,l,mid,x,y,s),qu(id*2+1,mid+1,r,x,y,s)) : max(qu(id*2,l,mid,x,y,s),qu(id*2+1,mid+1,r,x,y,s)) ;
}
void upd(int id,int l,int r,int x,int v) {
if(x > r || x < l) return ;
if(x>=l && x<=r) {
    if(l==r) {
        segdp[id] = v;
        return;
    }
}
upd(id*2,l,(l+r)/2,x,v);
upd(id*2+1,(l+r)/2+1,r,x,v);
segdp[id] = min(segdp[id*2],segdp[id*2+1]);
}
int q(int id,int l,int r,int x,int y) {
if(l > y || r <x) return INT_MAX;
if(l>=x && r<=y) return segdp[id];
int mid = (l+r)/2;
return min(q(id*2,l,mid,x,y),q(id*2+1,mid+1,r,x,y));
}
int main()
{
    ios_base::sync_with_stdio(false);
    int n,s,le;
    cin >> n >> s >> le;
    for(int i =0;i<n;i++) cin >> Arr[i];
    build(1,0,n-1);
    for(int i =le-1;i<n;i++) {
            dp[i] = (qu(1,0,n-1,0,i,0) - qu(1,0,n-1,0,i,1) <= s) ? 1 : 0;
            upd(1,0,n-1,i,dp[i]);
    }
    for(int i =2*le-1;i<n;i++) {
        int mid;
        int l =le;
        int diff=-INT_MAX;
        int r = i-le+1;
        for(int j =0;j<20;j++){
            mid = (l+r)/2;
            diff = qu(1,0,n-1,mid,i,0) - qu(1,0,n-1,mid,i,1);
            if(diff > s) l = mid+1;
            else r = mid;
        }
        if(diff > s && !dp[i]) dp[i] = INT_MAX;
        else {
                int z =q(1,0,n-1,mid-1,i-le);
                if(z==INT_MAX) dp[i] = z;
                else {
                    if(!dp[i]) dp[i] = z+1;
                    else dp[i] = min(dp[i],z+1);
                }
        }
        upd(1,0,n-1,i,dp[i]);
       // cout << diff << endl;
    }
    if(!dp[n-1] || dp[n-1] == INT_MAX) cout << -1;
    else cout << dp[n-1];
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int Arr[100005];
int seg[400002][2];
int segdp[400002];
int dp[100005];
void build(int id,int l,int r) {
if(l==r) {
        seg[id][0] = seg[id][1]  = Arr[l];
        return;
}
int mid=  (l+r)/2;
build(id*2,l,mid);
build(id*2+1,mid+1,r);
seg[id][0] = min(seg[id*2][0],seg[id*2+1][0]);
seg[id][1] = max(seg[id*2][1],seg[id*2+1][1]);
}
int qu(int id,int l,int r,int x,int y,int s) {
if(l > y || r <x) return (s) ? INT_MAX : -INT_MAX;
if(l >=x && r<=y)  return (s) ? seg[id][0] : seg[id][1];
int mid = (l+r)/2;
return (s) ? min(qu(id*2,l,mid,x,y,s),qu(id*2+1,mid+1,r,x,y,s)) : max(qu(id*2,l,mid,x,y,s),qu(id*2+1,mid+1,r,x,y,s)) ;
}
void upd(int id,int l,int r,int x,int v) {
if(x > r || x < l) return ;
if(x>=l && x<=r) {
    if(l==r) {
        segdp[id] = v;
        return;
    }
}
upd(id*2,l,(l+r)/2,x,v);
upd(id*2+1,(l+r)/2+1,r,x,v);
segdp[id] = max(segdp[id*2],segdp[id*2+1]);
}
int q(int id,int l,int r,int x,int y) {
if(l > y || r <x) return -INT_MAX;
if(l>=x && r<=y) return segdp[id];
int mid = (l+r)/2;
return max(q(id*2,l,mid,x,y),q(id*2+1,mid+1,r,x,y));
}
int main()
{
    ios_base::sync_with_stdio(false);
    int n,s,le;
    cin >> n >> s >> le;
    for(int i =0;i<n;i++) cin >> Arr[i];
    build(1,0,n-1);
    for(int i =le-1;i<n;i++) {
            dp[i] = (qu(1,0,n-1,0,i,0) - qu(1,0,n-1,0,i,1) <= s) ? 1 : 0;
            upd(1,0,n-1,i,dp[i]);
    }
    for(int i =2*le-1;i<n;i++) {
        int mid;
        int l =le;
        int diff=-INT_MAX;
        int r = i-le+1;
        for(int j =0;j<20;j++){
            mid = (l+r)/2;
            diff = qu(1,0,n-1,mid,i,0) - qu(1,0,n-1,mid,i,1);
            if(diff > s) l = mid+1;
            else r = mid;
        }
        if(diff > s && !dp[i]) dp[i] = -1;
        else {
                int z =q(1,0,n-1,mid-1,i-le);
                dp[i] = (z==-1) ? z : z+1;
        }
        upd(1,0,n-1,i,dp[i]);
    }
    if(!dp[n-1] || dp[n-1] == -1) cout << -1;
    else cout << dp[n-1];
    return 0;
}