// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
vector<P> li[maxn];
int m, n, k, t;
vector<int> e;

bool check(int x){

	int ti = 0;
	int MI = e[e.size() - x];
	for (int i = 1; i <= n; i++){
			int f = i-1;
			for (int j = 0; j < li[i].size() && li[i][j].first > MI; j++){
				f = max(f, li[i][j].second);
			}
			ti += 2*(f-i+1);
			++ti;
			if (ti > t)return false;
	}
	return true;

}
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL

	scanf("%d%d%d%d", &m, &n, &k, &t);
	LobN = 2e5+10;
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		e.push_back(x);
	}
	sort(ALL(e));
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		li[a].push_back({ c,b });
	}
	for (int i = 1; i <= n; i++)sort(ALL(li[i]),greater<P>());
	int l=0, r=m;
	while (l <= r){
		int mid = l + r >> 1;
		if (check(mid))l = mid + 1;
		else r = mid - 1;
	}
	cout << r << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL

	int m, n, k, t;
	scanf("%d%d%d%d", &m, &n, &k, &t);
	LobN = 2e5+10;
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		add(c, x, 1);
	}
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		f[b] = max(f[b], c);
	}
	multiset<int> st;
	for (int i = 0; i <= n+1; i++)st.insert(f[i]);
	ll ans = 0;
	for (int i = 1; i <= n; i++){
		ll tmp = 3 * i + n - i+1;
		if (tmp <= t){
			auto it = st.lower_bound(f[i]);
			st.erase(it);
			ans = max(ans, que(c, *st.rbegin()));
		}
		else break;
	}
	cout << ans << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL

	int m, n, k, t;
	scanf("%d%d%d%d", &m, &n, &k, &t);
	LobN = 2e5+10;
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		add(c, x, 1);
	}
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		f[b] = max(f[b], c);
	}
	multiset<int> st;
	for (int i = 0; i <= n+1; i++)st.insert(f[i]);
	ll ans = 0;
	for (int i = 0; i <= n; i++){
		ll tmp = 3 * i + n - i+1;
		if (tmp <= t){
			auto it = st.lower_bound(f[i]);
			st.erase(it);
			ans = max(ans, que(c, *st.rbegin()));
		}
		else break;
	}
	cout << ans << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
vector<P> li[maxn];
int m, n, k, t;
vector<int> e;

bool check(int x){
	int MI = e[e.size() - x];
	for (int i = 1; i <= n; i++)f[i] = 0;
	for (int i = 1; i <= n; i++){
		for (int j = 0; j<li[i].size() && li[i][j].first>MI; j++)
			f[i]++,f[li[i][j].second+1]--;
	}
	for (int i = 1; i <= n; i++)f[i] += f[i - 1];
	ll res = 0;
	for (int i = 1; i <= n; i++){
		if (f[i])res += 3;
		else res += 1;
	}
	return res+1 <= t;
}
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL
	scanf("%d%d%d%d", &m, &n, &k, &t);
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		e.push_back(x);
	}
	sort(ALL(e));
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		li[a].push_back({ c,b });
	}
	for (int i = 1; i <= n; i++)sort(ALL(li[i]),greater<P>());
	int l=1, r=m;
	while (l <= r){
		int mid = l + r >> 1;
		if (check(mid))l = mid + 1;
		else r = mid - 1;
	}
	cout << r << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL

	int m, n, k, t;
	scanf("%d%d%d%d", &m, &n, &k, &t);
	LobN = m+1;
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		add(c, x, 1);
	}
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		f[b] = max(f[b], c);
	}
	multiset<int> st;
	for (int i = 0; i <= n+1; i++)st.insert(f[i]);
	ll ans = 0;
	for (int i = 1; i <= n; i++){
		ll tmp = 3 * i + n - i+1;
		if (tmp <= t){
			auto it = st.lower_bound(f[i]);
			st.erase(it);
			ans = max(ans, que(c, *st.rbegin()));
		}
		else break;
	}
	cout << ans << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
vector<P> li[maxn];
int m, n, k, t;
vector<int> e;

bool check(int x){
	int MI = e[e.size() - x];
	for (int i = 1; i <= n; i++)f[i] = 0;
	for (int i = 1; i <= n; i++){
		for (int j = 0; j<li[i].size() && li[i][j].first>MI; j++)
			f[i]++,f[li[i][j].second+1]--;
	}
	for (int i = 1; i <= n; i++)f[i] += f[i - 1];
	ll res = 0;
	for (int i = 1; i <= n+1; i++){
		if (f[i])res += 3;
		else res += 1;
	}
	return res <= t;
}
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL
	scanf("%d%d%d%d", &m, &n, &k, &t);
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		e.push_back(x);
	}
	sort(ALL(e));
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		li[a].push_back({ c,b });
	}
	for (int i = 1; i <= n; i++)sort(ALL(li[i]),greater<P>());
	int l=1, r=m;
	while (l <= r){
		int mid = l + r >> 1;
		if (check(mid))l = mid + 1;
		else r = mid - 1;
	}
	cout << r << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
vector<P> li[maxn];
int m, n, k, t;
vector<int> e;

bool check(int x){
	int MI = e[e.size() - x];
	for (int i = 1; i <= n; i++)f[i] = 0;
	for (int i = 1; i <= n; i++){
		for (int j = 0; j<li[i].size() && li[i][j].first>MI; j++)
			f[i]++,f[li[i][j].second+1]--;
	}
	for (int i = 1; i <= n; i++)f[i] += f[i - 1];
	ll res = 0;
	for (int i = 1; i <= n+1; i++){
		if (f[i])res += 3;
		else res += 1;
	}
	return res <= t;
}
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL
	scanf("%d%d%d%d", &m, &n, &k, &t);
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		e.push_back(x);
	}
	sort(ALL(e));
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		li[a].push_back({ c,b });
	}
	for (int i = 1; i <= n; i++)sort(ALL(li[i]),greater<P>());
	int l=3, r=3;
	while (l <= r){
		int mid = l + r >> 1;
		if (check(mid))l = mid + 1;
		else r = mid - 1;
	}
	cout << r << endl;
	return TIME;
}


// #pragma GCC optimize(3)
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define Discertize(x) sort(ALL(x)),x.erase(unique(x.begin(),x.end()),x.end());
#define SZ(x) ((int)(x).size())
#define P2(x) ((x)*(x))
#define continue(x) { x; continue; }
#define break(x) { x; break; }
#define P pair<int,int>

#ifdef LOCAL
#define debug(x) cout << "[" __FUNCTION__ ": " #x " = " << (x) << "]\n"
#define TIME cout << "RunTime: " << clock() << "ms\n", 0
#else
#define debug(x) ;
#define TIME 0
#endif
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
const int maxm = 2e5 + 10;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
//lowbit---------------------------------------------------------------------
int LobN;//定义长度
inline int lowbit(int x){ return (x&(-x)); }
void add(ll*c, int x, ll v){ x = LobN - x + 1; while(x <= LobN)c[x] += v, x += lowbit(x); }
ll que(ll*c, int x){ x = LobN - x + 1; ll res = 0; while (x)res += c[x], x -= lowbit(x); return res; }
//----------------------------------------------------------------------------
template<typename S, typename T> inline bool Min(S &a, const T &b){ return a > b ? a = b, true : false; }
template<typename S, typename T> inline bool Max(S &a, const T &b){ return a < b ? a = b, true : false; }
template<typename S, typename T> inline void Adm(S &a, const T &b){ a = (a + b) % mod; if (a < 0) a += mod; }
template<typename S, typename T> inline void Mum(S &a, const T &b){ a = 1LL * a * b % mod; }
template<typename T> inline T Gcd(T a, T b){ while (b){ T t = b; b = a % b; a = t; }return a; }
template<typename T> inline int BitCnt(T x){ int cnt = 0; while (x)++cnt, x &= x - 1; return cnt; }
template<typename T> inline bool IsPri(T x) { if (x < 2) return false; for (T i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; }
inline ll qpow(ll a, ll n){ ll t = 1; while (n){ if (n & 1)t = t * a % mod; a = a * a % mod, n >>= 1; }return t%mod; }
ll c[maxn];
int  f[maxn];
vector<P> li[maxn];
int m, n, k, t;
vector<int> e;

bool check(int x){
	int ti = 0;
	int MI = e[e.size() - x];
	for (int i = 1; i <= n+1; i++){
			int f = i-1;
			for (int j = 0; j < li[i].size() && li[i][j].first > MI; j++)
				f = max(f, li[i][j].second);
			ti += 2*(f-i+1);
			++ti;
			if (ti > t)return false;
	}
	return true;

}
int main(){
#ifdef LOCAL
	//freopen("D:\input.txt", "r", stdin);
#endif // LOCAL
	scanf("%d%d%d%d", &m, &n, &k, &t);
	int x;
	for (int i = 1; i <= m; i++){
		scanf("%d", &x);
		e.push_back(x);
	}
	sort(ALL(e));
	for (int i = 1; i <= k; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		li[a].push_back({ c,b });
	}
	for (int i = 1; i <= n; i++)sort(ALL(li[i]),greater<P>());
	int l=1, r=m;
	while (l <= r){
		int mid = l + r >> 1;
		if (check(mid))l = mid + 1;
		else r = mid - 1;
	}
	cout << r << endl;
	return TIME;
}


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,ti=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				ans+=2*min( (mr-i),(mr-pos) );
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}
		pos=max(pos,i);
		ans++;
		if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,ti=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		pos=max(pos,i);
		if(!v[i].empty())
		{
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				//ans+=2*min( (mr-i),(mr-pos) );
				ans+=2*(mr-pos);
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}

		ans++;
		if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	ans=min(ans,m);
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
typedef long long LL;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int n,m,t,k;

bool cmp(int a,int b){ return a>b; }

bool check(int x)
{
	LL tt=0; tt=a[x];
	//for(int i=1;i<=x;i++) t+=a[i];
	int rr=0;
	for(int i=1;i<=k;i++)
	{
		if(d[i]>tt) rr=max(rr,r[i]);
	}
	LL tot=rr*2+n+1;
	if(tot>t) return false;
	return true;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d%d",&l[i],&r[i],&d[i]);
	}
	sort(a+1,a+1+n,cmp);
	int l=0,r=m;
	int ans=0;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) l=mid+1,ans=mid;
		else r=mid-1;
	}
	printf("%d\n",ans);
}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
const int maxn=2e5+5;
typedef long long LL;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int m,n,k,t;
struct node{
	int l,r;
	bool operator < (const node &rhs) const
	{
		if(l==rhs.l) return r<rhs.r;
		return l<rhs.l;
	}
};

bool cmp(int a,int b) { return a>b; }

bool check(int x)
{
	//printf("x==%d\n",x);
	int f=a[x];
	vector<struct node> v;
	for(int i=1;i<=k;i++)
	{
		if(d[i]<=f) continue;
		v.push_back(node{l[i],r[i]});
		//printf("l==%d,r==%d,d==%d\n",l[i],r[i],d[i]);
	}
	sort(v.begin(),v.end());
	LL res=0; int pos=0;
	for(int i=0;i<v.size();i++)
	{
		if(pos>=v[i].r) continue;
		if(pos<v[i].l) pos=v[i].l-1;
		res+=2ll*(v[i].r-pos);
		pos=v[i].r;
	}
	res+=1ll*(n+1);
	//printf("res==%d\n",res);
	return res<=t;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++) scanf("%d%d%d",&l[i],&r[i],&d[i]);
	sort(a+1,a+1+m,cmp);
	a[0]=0x3f3f3f3f;
	int ll=0; int rr=m;
	int ans=0;
	while(ll<=rr)
	{
		int mid=(ll+rr)>>1;
		//printf("mid==%d\n",mid);
		if(check(mid)) ll=mid+1,ans=mid;
		else rr=mid-1;
	}
	printf("%d\n",ans);
}


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				ans+=2*min( (mr-i),(mr-pos) );
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}
		ans++;
		//if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#include<bits/stdc++.h>
#include<vector>
using namespace std;
const int maxn=2e5+5;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int m,n,k,t;
struct node{
	int l,r;
	bool operator < (const node &rhs) const
	{
		if(l==rhs.l) return r<rhs.r;
		return l<rhs.l;
	}
};
bool cmp(int a,int b) { return a>b; }

bool check(int x)
{
	//printf("x==%d\n",x);
	int f=a[x];
	vector<struct node> v;
	for(int i=1;i<=k;i++)
	{
		if(d[i]<=f) continue;
		v.push_back(node{l[i],r[i]});
		//printf("l==%d,r==%d,d==%d\n",l[i],r[i],d[i]);
	}
	sort(v.begin(),v.end());
	int res=0; int pos=0;
	for(int i=0;i<v.size();i++)
	{
		if(pos<v[i].l) pos=v[i].l-1;
		res+=2*(v[i].r-pos);
	}
	res+=n;
	//printf("res==%d\n",res);
	return res<=t;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++) scanf("%d%d%d",&l[i],&r[i],&d[i]);
	sort(a+1,a+1+m,cmp);
	int ll=0; int rr=m;
	int ans=0;
	while(ll<=rr)
	{
		int mid=(ll+rr)>>1;
		if(mid==0)
		{
			ans=0;
			break;
		}
		//printf("mid==%d\n",mid);
		if(check(mid)) ll=mid+1,ans=mid;
		else rr=mid-1;
	}
	printf("%d\n",ans);
}


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,ti=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				ans+=2*min( (mr-i),(mr-pos) );
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}
		ans++;
		if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#include<bits/stdc++.h>
#include<vector>
using namespace std;
const int maxn=2e5+5;
typedef long long LL;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int m,n,k,t;
struct node{
	int l,r;
	bool operator < (const node &rhs) const
	{
		if(l==rhs.l) return r<rhs.r;
		return l<rhs.l;
	}
};

bool cmp(int a,int b) { return a>b; }

bool check(int x)
{
	//printf("x==%d\n",x);
	int f=a[x];
	vector<struct node> v;
	for(int i=1;i<=k;i++)
	{
		if(d[i]<=f) continue;
		v.push_back(node{l[i],r[i]});
		//printf("l==%d,r==%d,d==%d\n",l[i],r[i],d[i]);
	}
	sort(v.begin(),v.end());
	LL res=0; int pos=0;
	for(int i=0;i<v.size();i++)
	{
		if(pos>=v[i].r) continue;
		if(pos<v[i].l) pos=v[i].l-1;
		res+=2ll*(v[i].r-pos);
		pos=v[i].r;
	}
	res+=1ll*(n+1);
	//printf("res==%d\n",res);
	return res<=t;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++) scanf("%d%d%d",&l[i],&r[i],&d[i]);
	sort(a+1,a+1+m,cmp);
	int ll=0; int rr=m;
	int ans=0;
	while(ll<=rr)
	{
		int mid=(ll+rr)>>1;
		if(mid==0)
		{
			ans=0;
			break;
		}
		//printf("mid==%d\n",mid);
		if(check(mid)) ll=mid+1,ans=mid;
		else rr=mid-1;
	}
	printf("%d\n",ans);
}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
const int maxn=2e5+5;
typedef long long LL;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int m,n,k,t;
struct node{
	int l,r;
	bool operator < (const node &rhs) const
	{
		if(l==rhs.l) return r<rhs.r;
		return l<rhs.l;
	}
};

bool cmp(int a,int b) { return a>b; }

bool check(int x)
{
	//printf("x==%d\n",x);
	int f=a[x];
	vector<struct node> v;
	for(int i=1;i<=k;i++)
	{
		if(d[i]<=f) continue;
		v.push_back(node{l[i],r[i]});
		//printf("l==%d,r==%d,d==%d\n",l[i],r[i],d[i]);
	}
	sort(v.begin(),v.end());
	LL res=0; int pos=0;
	for(int i=0;i<v.size();i++)
	{
		if(pos>=v[i].r) continue;
		if(pos<v[i].l) pos=v[i].l-1;
		res+=2ll*(v[i].r-pos);
		pos=v[i].r;
	}
	res+=1ll*(n+1);
	//printf("res==%d\n",res);
	return res<=t;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++) scanf("%d%d%d",&l[i],&r[i],&d[i]);
	sort(a+1,a+1+m,cmp);
	int ll=0; int rr=m;
	int ans=0;
	while(ll<=rr)
	{
		int mid=(ll+rr)>>1;
		//printf("mid==%d\n",mid);
		if(check(mid)) ll=mid+1,ans=mid;
		else rr=mid-1;
	}
	printf("%d\n",ans);
}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
const int maxn=2e5+5;
int a[maxn]; int l[maxn]; int r[maxn]; int d[maxn];
int m,n,k,t;
struct node{
	int l,r;
	bool operator < (const node &rhs) const
	{
		if(l==rhs.l) return r<rhs.r;
		return l<rhs.l;
	}
};
bool cmp(int a,int b) { return a>b; }

bool check(int x)
{
	//printf("x==%d\n",x);
	int f=a[x];
	vector<struct node> v;
	for(int i=1;i<=k;i++)
	{
		if(d[i]<=f) continue;
		v.push_back(node{l[i],r[i]});
		//printf("l==%d,r==%d,d==%d\n",l[i],r[i],d[i]);
	}
	sort(v.begin(),v.end());
	int res=0; int pos=0;
	for(int i=0;i<v.size();i++)
	{
		if(pos<v[i].l) pos=v[i].l-1;
		if(v[i].r>pos)res+=2*(v[i].r-pos);
		pos=v[i].r;
	}
	res+=n;
	//printf("res==%d\n",res);
	return res<=t;
}

int main(void)
{
	scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<=k;i++) scanf("%d%d%d",&l[i],&r[i],&d[i]);
	sort(a+1,a+1+m,cmp);
	int ll=0; int rr=m;
	int ans=0;
	while(ll<=rr)
	{
		int mid=(ll+rr)>>1;
		if(mid==0)
		{
			ans=0;
			break;
		}
		//printf("mid==%d\n",mid);
		if(check(mid)) ll=mid+1,ans=mid;
		else rr=mid-1;
	}
	printf("%d\n",ans);
}


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,ti=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		pos=max(pos,i);
		if(!v[i].empty())
		{
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				//ans+=2*min( (mr-i),(mr-pos) );
				ans+=2*(mr-pos);
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}

		ans++;
		if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#define debug2 printf("!!!!!\n");
#define debug printf("-------------------\n");
#define debug3 printf("^^^^^^^^^^^\n");
#define ii inline
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long
#define pb push_back
#define fio std::ios::sync_with_stdio(false);cin.tie(0);
#include<bits/stdc++.h>
using namespace std;
const int MM=2e5+80;
ii void read(int &x)
{
	x=0; char c=getchar(); int sign=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') sign*=-1;
	for(;'0'<=c&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^48);
	x*=sign;
}
struct Trap {
	int r,d;
	bool operator < (const Trap &rhs) const {
		return d>rhs.d;
	}
};
vector<Trap>v[MM];
int a[MM];
bool cmp(int x,int y) { return x>y; }
bool Ok(int x,int mt,int n)
{
	int ans=0,ti=0,pos=0; // pos 记录去过的最右的位置
	//printf("x=%d a[x]=%d\n",x,a[x]);
	for(int i=0;i<=n;i++) {
		pos=max(pos,i);
		if(!v[i].empty())
		{
			int mr=i;
			for(int j=0;j<v[i].size();j++) {
				if(v[i][j].d>a[x])
					mr=max(mr,v[i][j].r);
				//else break;
			}
			if(pos<mr) {
				//ans+=2*min( (mr-i),(mr-pos) );
				ans+=mr-pos;
				pos=mr;
			}
			//printf("i=%d mr=%d ans=%d\n",i,mr,ans);
		}

		ans++;
		if(ans>mt) return false;
	}
	//printf("ans=%d\n",ans); debug;
	if(ans<=mt) return true;
	return false;
}
void Solve()
{
	int m,n,k,t; scanf("%d%d%d%d",&m,&n,&k,&t);
	for(int i=1;i<=m;i++) read(a[i]);
	sort(a+1,a+1+m,cmp);
	for(int i=1;i<=k;i++) {
		int l,r,d;
		read(l); read(r); read(d);
		Trap t=(Trap){r,d};
		//if(r>=l)
			v[l-1].pb(t);
	}
	for(int i=0;i<=n;i++) {
		if(!v[i].empty()) {
			sort(v[i].begin(),v[i].end());
		}
	}
	int ans=0,l=0,r=m; a[0]=MM<<1; a[m+1]=0;
	while (l<=r) {
		int mid=l+r>>1;
		if( Ok(mid,t,n) ) { ans=mid; l=mid+1; }
		else r=mid-1;
	}
	if(Ok(ans+1,t,n)) ans++;
	printf("%d\n",ans);
}
int main()
{
	int T=1; //scanf("%d",&T);
	for(int kase=1;kase<=T;kase++) {
		for(int i=0;i<MM;i++) v[i].clear();
		Solve();
	}
	return 0;
}
/*

*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int w[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=0,can=0,last=0;
        for(int i=0;i<=n;i++)w[i]=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d>a[mid])w[trap[i].l]++,w[trap[i].r+1]--;
        }
        for(int i=1;i<=n+1;i++)
        {
            can+=w[i];
            if(can)sum+=3;
            else sum+=1;
        }
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                //cout<<ans<<" "<<sum<<endl;
    }
    cout<<m-r<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m-1;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=n,can=0,last=0,cl=0,rl=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d<=a[mid])continue;
            if(trap[i].l<=trap[last].r)rl=max(rl,trap[i].r);
            else sum+=2*(rl-cl+1),rl=trap[i].r,cl=trap[i].l;
            last=i;
        }
        sum+=2*(rl-cl+1);
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                cout<<ans<<" "<<sum<<endl;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m-1;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=n,can=0,last=0,cl=0,rl=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d<=a[mid])continue;
            if(trap[i].l<=trap[last].r)rl=max(rl,trap[i].r);
            else sum+=2*(rl-cl+1),rl=trap[i].r,cl=trap[i].l;
            last=i;
        }
        sum+=2*(rl-cl+1);
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                //cout<<ans<<" "<<sum<<endl;
    }
    ans=max(1,ans);
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int w[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m-1;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=0,can=0,last=0;
        for(int i=0;i<=n;i++)w[i]=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d>a[mid])w[trap[i].l]++,w[trap[i].r+1]--;
        }
        for(int i=1;i<=n+1;i++)
        {
            can+=w[i];
            if(can)sum+=3;
            else sum+=1;
        }
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                //cout<<ans<<" "<<sum<<endl;
    }
    cout<<m-r<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m-1;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int now=0,p=0,mn=mod,sum=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].l>n)break;
            if(trap[i].d>a[mid])now++;
        }
        for(int i=0;i<k;i++)
        {
            if(!now)break;
            if(trap[i].d>a[mid])p=max(trap[i].r,p),now--;
        }
        sum=2*p+n;
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int w[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=0,can=0,last=0;
        for(int i=0;i<=n+1;i++)w[i]=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d>a[mid])w[trap[i].l]++,w[trap[i].r+1]--;
        }
        for(int i=1;i<=n+1;i++)
        {
            can+=w[i];
            if(can)sum+=3;
            else sum+=1;
        }
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                //cout<<ans<<" "<<sum<<endl;
    }
    cout<<m-r<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+7;
const ll mod=1e9+7,base=10000;
ll read(){ll ret=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();
return ret*f;}
int a[maxn];
struct asd
{
    int l,r,d;
    bool operator <(asd &a)
    {
        if(l==a.l)return r<a.r;
        return l<a.l;
    }
}trap[maxn];
int main()
{
    int m=read(),n=read(),k=read(),t=read();
    for(int i=0;i<m;i++)a[i]=read();
    for(int i=0;i<k;i++)
    {
        trap[i].l=read(),trap[i].r=read(),trap[i].d=read();
    }
    sort(trap,trap+k);
    sort(a,a+m);
    int l=0,r=m;
    int ans=0;
    while(l<r)
    {
        int mid=(l+r)>>1;
        int sum=n+1,can=0,last=0,cl=0,rl=0;
        for(int i=0;i<k;i++)
        {
            if(trap[i].d<=a[mid])continue;
            if(trap[i].l<=trap[last].r)rl=max(rl,trap[i].r);
            else sum+=2*(rl-cl+1),rl=trap[i].r,cl=trap[i].l;
            last=i;
        }
        sum+=2*(rl-cl+1);
        if(sum<=t)r=mid,ans=m-mid;
        else l=mid+1;
                //cout<<ans<<" "<<sum<<endl;
    }
    cout<<ans<<endl;
}


#include <stdio.h>
unsigned char _is_sorted(unsigned int, unsigned int, unsigned int, unsigned int Org_Array[]);

int main()
{
    unsigned int n;
    scanf("%u", &n);
    unsigned int Org_Array[n], i;
    for( i = 0; i < n; i++ ){
        scanf("%u", &Org_Array[i] );
    }
    if( 1 == n){    printf("yes\n1 1");     return 0;   }
    for( i = 0; i < (n-1); i++ ){
        if( Org_Array[i] > Org_Array[i+1] ){ break ;}
        if( i == (n-2) ){  printf("yes\n1 1");     return 0; }
    }
    unsigned int j;
    for( i = 1; i < n; i++){
        for( j = i+1; j <= n; j++){
            if( 1 == _is_sorted(i, j, n, Org_Array)){
                printf("yes\n%u %u", i, j); return 0;
            }
        }
    }
    printf("no");

    return 0;
}
unsigned char _is_sorted(unsigned int Str_Pos, unsigned int End_Pos, unsigned int n, unsigned int Org_Array[]){
    unsigned int Rev_Array[n], i;
    for( i = 0; i < n; i++ ){
        Rev_Array[i] = Org_Array[i];
    }
    //End_Pos--;
   // Str_Pos--;
    i = 0;
    while( End_Pos >= Str_Pos){
        Rev_Array[i] = Org_Array[End_Pos-1];
        End_Pos--;
        i++;
    }
    n--;
    for( i = 0; i < n; i++ ){
        if( Rev_Array[i] > Rev_Array[i+1] ){ return 0;}
    }
    return 1;
}


#include <stdio.h>
int main()
{
    unsigned int Size;
    scanf("%u", &Size);
    unsigned int i, j, Min, A[Size], Sorted_Array[Size];
    for( i = 0; i < Size; i++){
        scanf("%u", &A[i]);
        Sorted_Array[i] = A[i];
    }
    if( 1 == Size ){ printf("yes\n1 1"); return 0;}
   // Sorting A[] array
    for( i = 0;  i < (Size - 1); i++){
        Min = Sorted_Array[i];
        for( j = i; j <(Size-1); j++ ){
            if( Sorted_Array[i] > Sorted_Array[j+1] ){
                Sorted_Array[i] = Sorted_Array[j+1];
                Sorted_Array[j+1] = Min;
                Min = Sorted_Array[i];
            }
        }
    }
    int Start_Pos = -1, End_Pos = -1;
    for(i = 0; i < Size; i++){
        if( A[i] != Sorted_Array[i] ){
            Start_Pos = i;
            break;
        }
    }
    if( -1 == Start_Pos ){
        printf("yes\n1 1"); return 0;
    }
    i = Size - 1;
    for( ; i >= 0; i--){
        if( A[i] != Sorted_Array[i] ){
            End_Pos = i;
            break;
        }
    }

    unsigned int Revers_Array[Size];
    for( i = 0; i < Size; i++){
        Revers_Array[i] = A[i];
    }
    for( i = Start_Pos, j = End_Pos; i <= End_Pos; i++, j--){
        Revers_Array[i] = A[j];
    }
    for( i = 0; i < (Size-1); i++){
        if( Revers_Array[i] > Revers_Array[i+1] ){
            printf("no"); return 0;
        }
    }
    Start_Pos++;
    End_Pos++;
    printf("yes\n%d %d", Start_Pos, End_Pos);

    return 0;
}


#include <stdio.h>

unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int, unsigned int);
void QuickSort( unsigned int A[], int, int);
// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    int L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(int arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    unsigned int n; scanf("%u", &n);
    unsigned int A[n], Sorted_A[n];
    int i;
    for( i = 0; i < n; i++ ){
        scanf("%u", &A[i] );
        Sorted_A[i] = A[i];
    }
    mergeSort( Sorted_A, 0, n-1 );
    int x1 = -1, x2 = -1;
    for( i = 0; i < n; i++ ){
        if( A[i] != Sorted_A[i] ){
            x1 = i;
            break;
        }
    }
    if( -1 == x1 ){ printf("yes\n1 1"); return 0; }
    for( i = n-1; i >= 0; i-- ){
        if( A[i] != Sorted_A[i] ){
            x2 = i;
            break;
        }
    }
    int X1, X2;
    X1 = x1;
    X2 = x2;
    i = x2;
    for( ; x1 <= i; x1++, x2--){
        if( A[x1] != Sorted_A[x2] ){
           printf("no"); return 0;
        }
    }
    printf("yes\n%d %d", X1+1, X2+1 );

    return 0;
}

unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int i, unsigned int j){
    unsigned int Temp, _Switch = 0;
    while( i != j){
        if( A[j] < A[i]){
            if( 0 == _Switch ){
               Temp = A[i];
               A[i] = A[j];
               A[j] = Temp;
            }else{
                Temp = A[j];
                A[j] = A[i];
                A[i] = Temp;
            }
            _Switch ^= 1;

        }
        if( 0 == _Switch ){ j--; }else{ i++; }
    }

    return i;
}

void QuickSort( unsigned int A[], int i, int j){
    unsigned int index;
    if( i < j ){
     index = DivideArrayIntoTwoParts( A, i, j);
     QuickSort( A, index+1, j );
     QuickSort( A, i, index-1 );
    }
}


#include <stdio.h>
int main()
{
    unsigned int Size;
    scanf("%u", &Size);
    unsigned int i, j, Min, A[Size], Sorted_Array[Size];
    for( i = 0; i < Size; i++){
        scanf("%u", &A[i]);
        Sorted_Array[i] = A[i];
    }
    if( 1 == Size ){ printf("yes\n1 1"); return 0;}
   // Sorting A[] array
    for( i = 0;  i < (Size - 1); i++){
        Min = Sorted_Array[i];
        for( j = i; j <(Size-1); j++ ){
            if( Sorted_Array[i] > Sorted_Array[j+1] ){
                Sorted_Array[i] = Sorted_Array[j+1];
                Sorted_Array[j+1] = Min;
                Min = Sorted_Array[i];
            }
        }
    }
    int Start_Pos = -1, End_Pos = -1;
    for(i = 0; i < Size; i++){
        if( A[i] != Sorted_Array[i] ){
            Start_Pos = i;
            break;
        }
    }
    if( -1 == Start_Pos ){
        printf("yes\n1 1"); return 0;
    }
    i = Size - 1;
    for( ; i >= 0; i--){
        if( A[i] != Sorted_Array[i] ){
            End_Pos = i;
            break;
        }
    }

    unsigned int Revers_Array[Size];
    for( i = 0; i < Size; i++){
        Revers_Array[i] = A[i];
    }
    for( i = Start_Pos, j = End_Pos; i <= End_Pos; i++, j--){
        Revers_Array[i] = A[j];
    }
    for( i = 0; i < Size; i++){
        if( Revers_Array[i] != Sorted_Array[i] ){
            printf("no"); return 0;
        }
    }
    Start_Pos++;
    End_Pos++;
    printf("yes\n%d %d", Start_Pos, End_Pos);

    return 0;
}


#include <stdio.h>
unsigned char _is_sorted(unsigned int, unsigned int, unsigned int, unsigned int Org_Array[]);

int main()
{
    unsigned int n;
    scanf("%u", &n);
    unsigned int Org_Array[n], i;
    for( i = 0; i < n; i++ ){
        scanf("%u", &Org_Array[i] );
    }
    if( 1 == n){    printf("yes\n1 1");     return 0;   }
    for( i = 0; i < (n-1); i++ ){
        if( Org_Array[i] > Org_Array[i+1] ){ break ;}
        if( i == (n-2) ){  printf("yes\n1 1");     return 0; }
    }
    unsigned int j;
    //9

   //6 78 63 59 28 24 8 96 99
    for( i = 1; i < n; i++){
        for( j = i+1; j <= n; j++){
            if( 1 == _is_sorted(i, j, n, Org_Array)){
                printf("yes\n%u %u", i, j); return 0;
            }
        }
    }
    printf("no");

    return 0;
}
unsigned char _is_sorted(unsigned int Str_Pos, unsigned int End_Pos, unsigned int n, unsigned int Org_Array[]){
    unsigned int Rev_Array[n], i;
    for( i = 0; i < n; i++ ){
        Rev_Array[i] = Org_Array[i];
    }
    //End_Pos--;
   // Str_Pos--;
    i = Str_Pos;
    while( End_Pos >= Str_Pos){
        Rev_Array[i-1] = Org_Array[End_Pos-1];
        End_Pos--;
        i++;
    }
    n--;
    for( i = 0; i < n; i++ ){
        if( Rev_Array[i] > Rev_Array[i+1] ){ return 0;}
    }
    return 1;
}


#include <stdio.h>
unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int, unsigned int);
void QuickSort( unsigned int A[], int, int);
int main()
{
    unsigned int n; scanf("%u", &n);
    unsigned int A[n], Sorted_A[n];
    int i;
    for( i = 0; i < n; i++ ){
        scanf("%u", &A[i] );
        Sorted_A[i] = A[i];
    }
    QuickSort( Sorted_A, 0, n-1 );
    int x1 = -1, x2 = -1;
    for( i = 0; i < n; i++ ){
        if( A[i] != Sorted_A[i] ){
            x1 = i;
            break;
        }
    }
    if( -1 == x1 ){ printf("yes\n1 1"); return 0; }
    for( i = n-1; i >= 0; i-- ){
        if( A[i] != Sorted_A[i] ){
            x2 = i;
            break;
        }
    }
    int X1, X2;
    X1 = x1;
    X2 = x2;
    i = x2;
    for( ; x1 <= i; x1++, x2--){
        if( A[x1] != Sorted_A[x2] ){
           printf("no"); return 0;
        }
    }
    printf("yes\n%d %d", X1+1, X2+1 );

    return 0;
}

unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int i, unsigned int j){
    unsigned int Temp, _Switch = 0;
    while( i != j){
        if( A[j] < A[i]){
            if( 0 == _Switch ){
               Temp = A[i];
               A[i] = A[j];
               A[j] = Temp;
            }else{
                Temp = A[j];
                A[j] = A[i];
                A[i] = Temp;
            }
            _Switch ^= 1;

        }
        if( 0 == _Switch ){ j--; }else{ i++; }
    }

    return i;
}

void QuickSort( unsigned int A[], int i, int j){
    unsigned int index;
    if( i < j ){
     index = DivideArrayIntoTwoParts( A, i, j);
     QuickSort( A, index+1, j );
     QuickSort( A, i, index-1 );
    }
}


#include <stdio.h>

//unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int, unsigned int);
//void QuickSort( unsigned int A[], int, int);

// A utility function to swap two elements
void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

/* This function takes last element as pivot, places
   the pivot element at its correct position in sorted
    array, and places all smaller (smaller than pivot)
   to left of pivot and all greater elements to right
   of pivot */
int partition (int arr[], int low, int high)
{
    int pivot = arr[high];    // pivot
    int i = (low - 1);  // Index of smaller element
    int j;
    for ( j = low; j <= high- 1; j++)
    {
        // If current element is smaller than or
        // equal to pivot
        if (arr[j] <= pivot)
        {
            i++;    // increment index of smaller element
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

/* The main function that implements QuickSort
 arr[] --> Array to be sorted,
  low  --> Starting index,
  high  --> Ending index */
void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        /* pi is partitioning index, arr[p] is now
           at right place */
        int pi = partition(arr, low, high);

        // Separately sort elements before
        // partition and after partition
        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

int main()
{
    unsigned int n; scanf("%u", &n);
    unsigned int A[n], Sorted_A[n];
    int i;
    for( i = 0; i < n; i++ ){
        scanf("%u", &A[i] );
        Sorted_A[i] = A[i];
    }
    //QuickSort( Sorted_A, 0, n-1 );
    quickSort(Sorted_A, 0, n-1);
    int x1 = -1, x2 = -1;
    for( i = 0; i < n; i++ ){
        if( A[i] != Sorted_A[i] ){
            x1 = i;
            break;
        }
    }
    if( -1 == x1 ){ printf("yes\n1 1"); return 0; }
    for( i = n-1; i >= 0; i-- ){
        if( A[i] != Sorted_A[i] ){
            x2 = i;
            break;
        }
    }
    int X1, X2;
    X1 = x1;
    X2 = x2;
    i = x2;
    for( ; x1 <= i; x1++, x2--){
        if( A[x1] != Sorted_A[x2] ){
           printf("no"); return 0;
        }
    }
    printf("yes\n%d %d", X1+1, X2+1 );

    return 0;
}
/*
unsigned int DivideArrayIntoTwoParts(unsigned int A[], unsigned int i, unsigned int j){
    unsigned int Temp, _Switch = 0;
    while( i != j){
        if( A[j] < A[i]){
            if( 0 == _Switch ){
               Temp = A[i];
               A[i] = A[j];
               A[j] = Temp;
            }else{
                Temp = A[j];
                A[j] = A[i];
                A[i] = Temp;
            }
            _Switch ^= 1;

        }
        if( 0 == _Switch ){ j--; }else{ i++; }
    }

    return i;
}

void QuickSort( unsigned int A[], int i, int j){
    unsigned int index;
    if( i < j ){
     index = DivideArrayIntoTwoParts( A, i, j);
     QuickSort( A, index+1, j );
     QuickSort( A, i, index-1 );
    }
}
*/


#include <stdio.h>
#define all(a) a.begin(), a.end()
typedef long long int ll;

int n, a[100005];
int dem;
int ok;
int size;
int tmp1;
int index1, index2;

void Input() {
	scanf ("%d", &n);
	for ( int i = 0; i < n; i++)
		scanf ("%d", &a[i]);
	dem = 0;
	ok = 0;
	size = 0;
}

void Check() {
	for ( int i = 1; i< n-1; i++) {
		if ( a[i-1]>a[i] && a[i]<a[i+1] )
			dem++;
		if ( a[i-1]<a[i] && a[i]>a[i+1] )
			dem++;
	}
	if ( dem>2 ) {
		ok = 3;
		return;
	}
	if ( dem==0 ) {
		ok = 1;
		return;
	}
	if ( dem==1 ) {
		if ( a[0]<a[1] ) {
			for ( int i = n-1; i > 0; i--) {
				if ( a[i] > a[i-1]) {
					index1 = i;
					break;
				}
			}
			index2 = n-1;
			if ( a[index2] > a[index1-1]) {
				ok = 2;
				return;
			}
			else {
				ok = 3; return;
			}
		}
		else {
			for ( int i = 0; i < n; i++) {
				if ( a[i]<a[i+1] ) {
					index2 = i;
					break;
				}
			}
			index1 = 0;
			if ( a[index1] < a[index2+1] ) {
				ok=2; return;
			}
			else {
				ok=3; return;
			}
		}
	}
	else {
		if ( a[0]<a[1] ) {
			for ( int i = 0; i < n; i++)
				if ( a[i]>a[i+1] ) {
					index1 = i;
					break;
				}
			for ( int i = n-1; i > 0; i--) {
				if ( a[i] < a[i-1] ) {
					index2 = i;
					break;
				}
			}
			if ( a[index1] < a[index2+1] && a[index2] > a[index1-1] ) {
				ok = 2; return;
			}
			else {
				ok = 3;
				return ;
			}
		}
		else {
			ok = 3;
			return;
		}
	}
}

void Solve() {
	Check();
	if ( ok==3 ) {
		printf ("no\n");
		return;
	}
	if ( ok==1 ) {
	printf ("yes\n");
		if ( a[0]<a[1] )
			printf ("1 1\n");
		else
			printf ("1 %d\n", n);
	}
	if ( ok==2 ) {
		printf ("yes\n");
		printf ("%d %d", index1+1, index2+1);
	}
}

main()
{
//	IOS()
//	int test; cin >> test;
	Input();
	Solve();
}


#include <bits/stdc++.h>
using namespace std;
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(a) a.begin(), a.end()
typedef long long int ll;

int n, a[100005], b[10005];
int dem;
int ok;
int size;
int tmp1;

void Input() {
	cin >> n;
	for ( int i = 0; i < n; i++)
		cin >> a[i];
	dem = 0;
	ok = 0;
	size = 0;
}

void Check() {
	for ( int i = 1; i< n-1; i++) {
		if ( a[i-1]>a[i] && a[i]<a[i+1] )
			dem++;
		if ( a[i-1]<a[i] && a[i]>a[i+1] )
			dem++;
	}
	if ( dem>2 ) {
		ok = 3;
		return;
	}
	if ( dem==0 ) {
		ok = 1;
		return;
	}
	if ( dem==1 ) {
		if ( a[0]>a[1] ) {
			for ( int i = 0; a[i]>a[i+1] ;i++)
				b[size++] = a[i];
			int tmp2 = size;
			b[size++] = a[tmp2];
			if ( b[0] < a[tmp2+1] ) {
				ok = 2;
				return;
			}
			else {
				ok = 3; return;
			}
		}
		else {
			for (int i = 0; i < n; i++) {
				if ( a[i]>a[i+1] ) {
					int tmp2 = i-1;
					for ( int j = i; j<n; j++)
						b[size++] = a[j];
					if ( b[size-1] > a[tmp2] ) {
						ok=2; return;
					}
					else {
						ok = 3; return;
					}
				}
			}
		}
	}
	else {
		if ( a[0]<a[1] ) {
			for (int i = 0; i < n-1; i++) {
				if ( a[i] > a[i+1] ) {
					b[size++] = a[i];
				}
			}
			for (int i = 0; i < n; i++) {
				if ( a[i] < a[i+1] ) {
					tmp1 = i;
					break;
				}
			}
			int tmp2 = tmp1 + size+1;
			b[size++] = a[tmp2];
			if ( b[0] < a[tmp2+1] && b[size-1] > a[tmp1] ) {
				ok = 2;
				return;
			}
			else {
				ok = 3;
				return;
			}
		}
		else {
			ok = 3;
			return;
		}
	}
}

void Solve() {
	Check();
	if ( ok==3 ) {
		cout << "no" << endl;
		return;
	}
	if ( ok==1 ) {
		cout << "yes" << endl;
		sort(a,a+n);
		for ( int i = 0; i < n; i++) cout << a[i] << " ";
		return;
	}
	if ( ok==2 ) {
		cout << "yes" << endl;
		sort(b,b+size);
		for ( int i = 0; i < size; i++) cout << b[i] << " ";
	}
}

main()
{
	IOS()
//	int test; cin >> test;
	Input();
	Solve();
}


#include <stdio.h>
#define all(a) a.begin(), a.end()
typedef long long int ll;

int n, a[100005];
int dem;
int ok;
int size;
int tmp1;
int index1, index2;

void Input() {
	scanf ("%d", &n);
	for ( int i = 0; i < n; i++)
		scanf ("%d", &a[i]);
	dem = 0;
	ok = 0;
	size = 0;
}

void Check() {
	for ( int i = 1; i< n-1; i++) {
		if ( a[i-1]>a[i] && a[i]<a[i+1] )
			dem++;
		if ( a[i-1]<a[i] && a[i]>a[i+1] )
			dem++;
	}
	if ( dem>2 ) {
		ok = 3;
		return;
	}
	if ( dem==0 ) {
		ok = 1;
		return;
	}
	if ( dem==1 ) {
		if ( a[0]<a[1] ) {
			for ( int i = n-1; i > 0; i--) {
				if ( a[i] > a[i-1]) {
					index1 = i;
					break;
				}
			}
			index2 = n-1;
			if ( a[index2] > a[index1-1]) {
				ok = 2;
				return;
			}
			else {
				ok = 3; return;
			}
		}
		else {
			for ( int i = 0; i < n; i++) {
				if ( a[i]<a[i+1] ) {
					index2 = i;
					break;
				}
			}
			index1 = 0;
			if ( a[index1] < a[index2+1] ) {
				ok=2; return;
			}
			else {
				ok=3; return;
			}
		}
	}
	else {
		if ( a[0]<a[1] ) {
			for ( int i = 0; i < n; i++)
				if ( a[i]>a[i+1] ) {
					index1 = i;
					break;
				}
			for ( int i = n-1; i > 0; i--) {
				if ( a[i] < a[i-1] ) {
					index2 = i;
					break;
				}
			}
			if ( a[index1] < a[index2+1] && a[index2] > a[index1-1] ) {
				ok = 2; return;
			}
		}
		else {
			ok = 3;
			return;
		}
	}
}

void Solve() {
	Check();
	if ( ok==3 ) {
		printf ("no\n");
		return;
	}
	if ( ok==1 ) {
		printf ("yes\n");
		if ( a[0]<a[1] )
			printf ("1 1\n");
		else
			printf ("1 %d\n", n);
	}
	if ( ok==2 ) {
		printf ("yes\n");
		printf ("%d %d", index1+1, index2+1);
	}
}

main()
{
//	IOS()
//	int test; cin >> test;
	Input();
	Solve();
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
int ordenado_ascendente(int*,int);
void is_digit(char s[]);
void append(char*,char);

void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    int cumple= 0;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) == 1 ){
        cumple = 1;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam) == 1){
        cumple=1;
    }

    if(cumple == 1)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

int ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam && i+1<tam;i++){
            if( arr[i]>arr[i+1] )
                return 0;
    }
    return 1;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef enum{false,true} boolean;

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
boolean ordenado_ascendente(int*,int);
boolean is_digit(char s[]);
boolean append(char*,char);
void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    boolean cumple= false;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) ){
        cumple = true;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam) == true){
        cumple=true;
    }

    if(cumple == true)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

boolean ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam;i++){
            if( arr[i]>arr[i+1] )
                return false;
    }
    return true;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef enum{fal,tru} bul;

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
bul ordenado_ascendente(int*,int);
void is_digit(char s[]);
void append(char*,char);

void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    bul cumple= fal;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) == tru ){
        cumple = tru;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam) == tru){
        cumple=tru;
    }

    if(cumple == tru)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

bul ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam;i++){
            if( arr[i]>arr[i+1] )
                return fal;
    }
    return tru;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
int ordenado_ascendente(int*,int);
void is_digit(char s[]);
void append(char*,char);

void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    int cumple= 0;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) == 1 ){
        cumple = 1;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           printf("%d %d\n",num1,num2);
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam) == 1){
        cumple=1;
    }

    if(cumple == 1)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

int ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam && i+1<tam;i++){
            if( arr[i]>arr[i+1] )
                return 0;
    }
    return 1;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef enum{fal,tru} bul;

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
bul ordenado_ascendente(int*,int);
void is_digit(char s[]);
void append(char*,char);

void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    bul cumple= fal;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) ){
        cumple = tru;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam)){
        cumple=tru;
    }

    if(cumple)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

bul ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam;i++){
            if( arr[i]>arr[i+1] )
                return fal;
    }
    return tru;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int *fetchData(int);
int * createArrayOfIntegers(char*);
int alen(void * a);
int ordenado_ascendente(int*,int);
void is_digit(char s[]);
void append(char*,char);

void invertir( int* ,int, int );

void main(){
    int i,x,z,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    int cumple= 0;
    num1 = -1;
    num2 = -1;

    scanf(" %d",&tam);
    output = fetchData(tam);

    if(!output){
        printf("\nERROR INICIALIZANDO RECURSOS\n");
        return;
    }

    if ( ordenado_ascendente(output,tam) == 1 ){
        cumple = 1;
        printf("yes\n%d %d",1,1);
        exit(0);
    }

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(z=num2;z<tam  && output[z]>=output[z+1] && z+1<tam;z++){
                num2++;
           }
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,tam) == 1){
        cumple=1;
    }

    if(cumple == 1)
        printf("yes\n%d %d",num1+1,num2+1);
    else
        printf("no\n");
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

int ordenado_ascendente(int * arr,int tam){
    int i,z;

    for(i=0;i<tam;i++){
            if( arr[i]>arr[i+1] )
                return 0;
    }
    return 1;
}

int * fetchData(int tam){
    int * d = malloc(sizeof(int) * tam );
    int cont=0;

    while ( cont<tam ){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
#include <stdlib.h>

int *fetchData(int*);
int ordenado_ascendente(int*,int*);
void invertir( int* ,int, int );

void main(){
    int i,num1,num2;
    int tam = 0;
    char * data;
    int * output;

    int cumple= 0;
    num1 = 0;
    num2 = 0;

    scanf(" %d",&tam);
    output = fetchData(&tam);

    for(i=0;i<tam && i+1<tam;i++){
        if(output[i]>=output[i+1]){
           num1 = i;
           num2 = i+1;
           for(;num2<tam && output[num2]>=output[num2+1] && num2+1<tam;num2++);
           break;
        }
    }

    invertir(output,num1,num2);
    if(ordenado_ascendente(output,&tam) == 1){
        printf("yes\n%d %d",num1+1,num2+1);
    }else{
        printf("no\n");
    }
    free(output);
    exit(0);
}

void invertir( int * f ,int pos_o, int pos_f){
    int x;

    while( pos_o < pos_f ){
        x=f[pos_o];
        f[pos_o] = f[pos_f];
        f[pos_f] = x;

        pos_o++;
        pos_f--;
    }
}

int ordenado_ascendente(int * arr,int * tam){
    int i,z;

    for(i=0;i<(*tam) && i+1<(*tam);i++){
            if( arr[i]>arr[i+1] )
                return 0;
    }
    return 1;
}

int * fetchData(int * tam){
    int * d = malloc(sizeof(int) * (*tam) );
    int cont=0;

    while ( cont<(*tam)){
        scanf(" %d",&d[cont]);
        cont++;
    }
    return d;
}


#include <stdio.h>
int daygiam(int a[],int l, int r){
	for(int i=l+1;i<r;i++){
		if(a[i]<a[i+1])
			return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%d", &n);
	int a[n], sum=0;
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	int l,r;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			l=i-1;
			break;
		}
		if(i==n-1) l=0;
	}
	for(int i=l+1;i<n;i++){
		if(a[i]>=a[l]){
			r=i-1;
			break;
		}
		if(i==n-1) r=i;
	}
	if(daygiam(a,l,r))
		printf("yes\n%d %d", a[r], a[l]);
	else printf("no");

	return 0;
}


#include <stdio.h>
void daonguoc(int a[], int l, int r){
	int tmp;
	for(int i=l, j=r; i<j; i++, j--){
		tmp=a[i];
		a[i]=a[j];
		a[j]=tmp;
	}
}
int daytang(int a[],int n){
	for(int i=1;i<n;i++){
		if(a[i]<a[i])
			return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	int l,r;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			l=i-1;
			break;
		}
		if(i==n-1) l=0;
	}
	for(int i=l+1;i<n;i++){
		if(a[i]>=a[l]){
			r=i-1;
			break;
		}
		if(i==n-1) r=i;
	}
	daonguoc(a,l,r);
	if(daytang(a,n))
		printf("yes\n%d %d", l+1, r+1);
	else printf("no");

	return 0;
}


#include <stdio.h>
int daygiam(int a[],int l, int r){
	for(int i=l+1;i<r;i++){
		if(a[i]<a[i+1])
			return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%d", &n);
	int a[n], sum=0;
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	int l,r;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			l=i-1;
			break;
		}
		if(i==n-1) l=0;
	}
	for(int i=l+1;i<n;i++){
		if(a[i]>=a[l]){
			r=i-1;
			break;
		}
		if(i==n-1) r=i;
	}
	if(daygiam(a,l,r))
		printf("yes\n%d %d", l+1, r+1);
	else printf("no");

	return 0;
}


#include <stdio.h>
void daonguoc(int a[], int l, int r){
	int tmp;
	for(int i=l, j=r; i<j; i++, j--){
		tmp=a[i];
		a[i]=a[j];
		a[j]=tmp;
	}
}
int daytang(int a[],int n){
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1])
			return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	int l,r;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			l=i-1;
			break;
		}
		if(i==n-1) l=0;
	}
	for(int i=l+1;i<n;i++){
		if(a[i]>=a[l]){
			r=i-1;
			break;
		}
		if(i==n-1) r=i;
	}
	daonguoc(a,l,r);
	if(daytang(a,n))
		printf("yes\n%d %d", l+1, r+1);
	else printf("no");

	return 0;
}


#include <stdio.h>
void daonguoc(int a[], int l, int r){
	int tmp;
	for(int i=l, j=r; i<=r, j>=l; i++, j--){
		tmp=a[l];
		a[l]=a[j];
		a[j]=tmp;
	}
}
int daygiam(int a[],int n){
	for(int i=1;i<n;i++){
		if(a[i]<a[i+1])
			return 0;
	}
	return 1;
}
int main(){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	int l,r;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			l=i-1;
			break;
		}
		if(i==n-1) l=0;
	}
	for(int i=l+1;i<n;i++){
		if(a[i]>=a[l]){
			r=i-1;
			break;
		}
		if(i==n-1) r=i;
	}
	daonguoc(a,l,r);
	if(daygiam(a,n))
		printf("yes\n%d %d", l+1, r+1);
	else printf("no");

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
	long int n;
	scanf("%ld",&n);
	long long int arr[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%I64d",&arr[i]);
	}
	long long int start_min = 0 , end_max = 0;
	int flag1=0,flag2=0;
	int i = 0,j = n-1;
	for (; i < n,j >= 0,i < j;)
	{
		if (n ==1)
		{
			break;
		}
		if (arr[i+1] < arr[i])
		{
			if(i==0)
			{
				start_min = 0;
			}
			else
			{
				start_min = arr[i-1];
			}
			flag1 = 1;
		}
		else
		{
			++i;
			continue;
		}
		if (arr[j-1] > arr[j])
		{
			if (j==n-1)
			{
				end_max = 1000000000;
			}
			else
			{
				end_max = arr[j+1];
			}
			flag2 = 1;
		}
		else
		{
			--j;
			continue;
		}
		if (flag1==1 && flag2 ==1)
		{
			if (arr[j]<start_min)
			{
				printf("no");
				break;
			}
			if (arr[j]>end_max)
			{
				printf("no");
				break;
			}
			int k = i;
			for (; k < j; ++k)
			{
				if (arr[k]<start_min)
				{
					printf("no");
					break;
				}
				if (arr[k]>end_max)
				{
					printf("no");
					break;
				}
				if (arr[k]<arr[k+1])
				{
					printf("no");
					break;
				}
			}
			if(k==j)
			{
				flag1 = 0;
				flag2 = 0;
			}
			break;
		}
	}
	if(flag1 == 0 && flag2 == 0)
	{
		printf("yes\n");
		printf("%d %d",i+1,j+1);
	}
	return 0;
}


#include<stdio.h>

int a[100000];
void sort(int x, int y)
{
    int temp;
    temp=a[x];
    a[x]=a[y];
    a[y]=temp;
    return;
}

int main()
{
    int n,i,x=-1,y=-1;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            x=i;
            break;
        }
    for(i=n-1;i>0;i--)
        if(a[i]<a[i-1])
        {
            y=i;
            break;
        }
    if(x==-1&&y==-1)
    {
        printf("YES\n1 1");
        return 0;
    }
    sort(x,y);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            printf("no");
            return 0;
        }
    if(x>y)
    printf("yes\n%d %d",y+1,x+1);
    else
    printf("yes\n%d %d",x+1,y+1);
    return 0;

}


#include<stdio.h>

int a[100000];
void sort(int x, int y)
{
    int temp;
    temp=a[x];
    a[x]=a[y];
    a[y]=temp;
    return;
}

int main()
{
    int n,i,x=-1,y=-1;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            x=i;
            break;
        }
    for(i=n-1;i>0;i--)
        if(a[i]<a[i-1])
        {
            y=i;
            break;
        }
    if(x==-1&&y==-1)
    {
        printf("yes\n1 1");
        return 0;
    }
    sort(x,y);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            printf("no");
            return 0;
        }
    if(x>y)
    printf("yes\n%d %d",y+1,x+1);
    else
    printf("yes\n%d %d",x+1,y+1);
    return 0;

}


#include<stdio.h>
int x[100000];
void sort(int a,int b)
{
    int temp,i,j;
    for(i=a,j=b;i<j;i++,j--)
    {
        temp=x[i];
        x[i]=x[j];
        x[j]=temp;
    }
    return;
}

int main()
{
    int n,t,a=-1,b=-1,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&x[i]);

    for(i=0;i<n-1;i++)
        if(x[i]>x[i+1])
        {
            a=i;
            break;
        }

    for(i=n-1;i>0;i--)
        if(x[i]<x[i-1])
        {
            b=i;
            break;
        }
    if(a==-1)
    {
    printf("yes\n1 1");
    return 0;
    }
    sort(a,b);
    for(i=0;i<n-1;i++)
        if(x[i]>x[i+1])
        {
            printf("no");
            return 0;
        }
    printf("yes\n%d %d",a+1,b+1);
}


#include<stdio.h>

int a[100000];
void sort(int x, int y)
{
    int temp;
    temp=a[x];
    a[x]=a[y];
    a[y]=temp;
    return;
}

int main()
{
    int n,i,x=-1,y=-1;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            x=i;
            break;
        }
    for(i=n-1;i>0;i--)
        if(a[i]<a[i-1])
        {
            y=i;
            break;
        }
    if(x==-1&&y==-1)
    {
        printf("YES\n1 1");
        return 0;
    }
    sort(x,y);
    for(i=0;i<n-1;i++)
        if(a[i]>a[i+1])
        {
            printf("NO");
            return 0;
        }
    if(x>y)
    printf("YES\n%d %d",y+1,x+1);
    else
    printf("YES\n%d %d",x+1,y+1);
    return 0;

}


#include <stdio.h>

void cal(int *, int);

int main() {

        int n;
        scanf("%d", &n);
        int arr[n], i;

        for( i = 0; i < n; i++)
	       scanf("%d", arr + i);

        cal(arr, n);

        return 0;
}

void cal(int *arr, int n) {

        int a, b, i;

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

	       if(arr[i + 1] < arr[i])
		      break;
        }
        if(i == n - 1) {
	       printf("yes\n1 1\n");
	       return ;
        }
        a = i;

        for(; i < n - 1; i++) {
	       if(arr[i + 1] > arr[i])
		      break;
        }

        b = i;

        if((a == 0) && (b == n -1)) {
	       printf("yes\n%d %d\n", a + 1, b + 1);
	       return ;
        }
        else if(!a) {

	       if(arr[b + 1] < arr[a]) {
		      printf("no\n");
		      return ;
	       }
        }
        else if(b == n - 1) {

	       if(arr[b] < arr[a - 1]) {
		      printf("no\n");
		      return ;
	       }
        }
        else if((arr[b + 1] < arr[a]) || (arr[b] < arr[a - 1])) {
	       printf("no\n");
	       return ;
        }

        for(i = b + 1; i < n - 1; i++) {
	       if(arr[i + 1] < arr[i]) {
		      printf("no\n");
		      return ;
	       }
        }

        printf("yes\n%d %d\n", a + 1, b + 1);

}


#include<stdio.h>
void mergesort(int arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
mergesort(arr, l, m);
mergesort(arr, m+1,r);
merge(arr, l, m, r);
}
}
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
i = 0;
j = 0;
k = l;
while (i < n1 && j < n2)
{
if (L[i] <= R[j])
{
arr[k] = L[i];
i++;
}
else
{
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1)
{
arr[k] = L[i];
i++;
k++;
}
while (j < n2)
{
arr[k] = R[j];
j++;
k++;
}
}

int main()
{
    int n,l=0,r=0;
    scanf("%d",&n);
    int ar[n],br[n];
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    br[i]=ar[i];
    }
    mergesort(br,0,n-1);
    for(int i=0;i<n-1;i++)
    {
    if(ar[i]>ar[i+1])
    {
    l=i;
    break;
    }
    }
    for(int i=n-1;i>0;i--)
    {
    if(ar[i-1]>ar[i])
    {
    r=i;
    break;
    }
    }
    int cnt=(r-l+1)/2,k=0;
    //printf("%d %d %d",l,r,cnt);
    for(int i=l;cnt>0;i++)
    {
    int tmp=ar[i];
    ar[i]=ar[r-k];
    ar[r-k]=tmp;
    cnt--;
    k++;
    }
    int f=0;
    for(int i=0;i<n;i++)
    {
    if(ar[i]!=br[i])
    {
    f=1;
    break;
    }
    }
    if(f==0)
    printf("yes\n%d %d",l+1,r+1);
    else
    printf("no");
    return 0;
}


#include<stdio.h>

int main()
{
    int n,r=0,l=0,g=0;
    scanf("%d",&n);
    int ar[n],f=0,cnt=0,bcnt=0;
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int i=0;i<n-1;i++)
    {
    if(ar[i]<=ar[i+1])
    cnt++;
    }
    for(int i=0;i<n-1;i++)
    {
    if(ar[i]>=ar[i+1])
    bcnt++;
    }
    if(cnt==n-1)
    printf("yes\n1 1");
    else if(bcnt==n-1)
    printf("yes\n1 %d",n);
    else
    {
    int j=1;
    while(ar[j]<=ar[j-1])
    {
    if(g==0)
    g=1;
    j++;
    }
    l=j;
    //printf("%d",l);
    if(g==0)
    printf("no");
    else
    {
    if(ar[0]<=ar[l])
    printf("yes\n%d %d",1,l);
    else
    printf("no");
    }
    }
    /*for(int i=0;i<n-1;i++)
    {
    if(ar[i]>ar[i+1])
    {
    int j=i+1;
    while(ar[j]<=ar[j-1])
    j++;
    r=j;
    cnt++;
    if(cnt>1)
    {
    f=1;
    break;
    }
    //printf("y");
    i=j-1;
    }
    }
    if(cnt==0)
    printf("yes\n1 1");
    else if(cnt==1)
    {
    int l=0;
    for(int i=0;i<n-1;i++)
    {
    if(ar[i]>ar[i+1])
    {
    l=i+1;
    break;
    }
    }
    /*for(int i=n-1;i>0;i--)
    {
    if(ar[i-1]>ar[i])
    {
    r=i-1;
    break;
    }
    }
    printf("%d %d %d %d",l,r,ar[l],ar[r]);
    if(l==r)
    printf("yes\n%d %d",l,r+2);
    else if(ar[l]<=ar[r])
    {

    printf("yes\n%d %d",l,r);
    }
    else
    printf("no");
    }
    else
    printf("no");*/
    return 0;
}


#include<stdio.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    int i,j;
 long long int A[n],idx1,idx2,p=0,c=0,l=0,counter=0,count=0;
 for(i=0;i<n;i++)
 {
     scanf("%lld",&A[i]);
 }
    for(i=0;i<n-1;i++)
    {
     if(A[i]>=A[i+1])
     {
         if(l==0)
         {
             idx1=i;
             l=1;
            c=1;
         }
         else
         {
             if(p==1)
             {

             counter++;
             break;
             }
             else
             {

                 continue;
             }
         }

     }

     else
     {
         if(c==1 && p==0)
         {
           idx2=i;

           counter++;
           p=1;
         }
         else
         {
             count++;
             continue;

         }

     }

    }

    if(counter==0)
    {
        idx2=n-1;
    }

    if(counter>1)
    {
        printf("no");
    }
    else if(count==n-1)
    {
        printf("yes\n1 1");
    }

    else
    {
      if(A[idx1]>A[idx2+1] && idx2!=n-1)
      {
          printf("no");
      }
      else if(A[idx2]<A[idx1-1] && idx1!=0)
      {
          printf("no");
      }
      else
      {
          printf("yes\n%lld %lld",idx1+1,idx2+1);
      }
    }

    return(0);
}


#include<stdio.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    int i,j;
 long long int A[n],idx1,idx2,p=0,c=0,l=0,counter=0,count=0;
 for(i=0;i<n;i++)
 {
     scanf("%lld",&A[i]);
 }
    for(i=0;i<n-1;i++)
    {
     if(A[i]>=A[i+1])
     {
         if(l==0)
         {
             idx1=i;
             l=1;
            c=1;
         }
         else
         {
             if(p==1)
             {

             counter++;
             break;
             }
             else
             {

                 continue;
             }
         }

     }

     else
     {
         if(c==1 && p==0)
         {
           idx2=i;

           counter++;
           p=1;
         }
         else
         {
             count++;
             continue;

         }

     }

    }

    if(counter==0)
    {
        idx2=n-1;
    }

    if(counter>1)
    {
        printf("no");
    }
    else if(count==n-1)
    {
        printf("yes\n1 1");
    }

    else
    {
      if(A[idx1]>A[idx2+1])
      {
          printf("no");
      }
      else
      {
          printf("yes\n%lld %lld",idx1+1,idx2+1);
      }
    }

    return(0);
}


#include<stdio.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    int i,j;
 long long int A[n],idx1,idx2,p=0,c=0,l=0,counter=0,count=0;
 for(i=0;i<n;i++)
 {
     scanf("%lld",&A[i]);
 }
    for(i=0;i<n-1;i++)
    {
     if(A[i]>=A[i+1])
     {
         if(l==0)
         {
             idx1=i;
             l=1;
            c=1;
         }
         else
         {
             if(p==1)
             {

             counter++;
             break;
             }
             else
             {

                 continue;
             }
         }

     }

     else
     {
         if(c==1 && p==0)
         {
           idx2=i;

           counter++;
           p=1;
         }
         else
         {
             count++;
             continue;

         }

     }

    }

    if(counter==0)
    {
        idx2=n-1;
    }

    if(counter>1)
    {
        printf("no");
    }
    else if(count==n-1)
    {
        printf("yes\n1 1");
    }

    else
    {
      if(A[idx1]>A[idx2+1] || A[idx2]<A[idx1-1])
      {
          printf("no");
      }
      else
      {
          printf("yes\n%lld %lld",idx1+1,idx2+1);
      }
    }

    return(0);
}


#include <stdio.h>
#include <stdlib.h>

/*
 *
 */
int main(int argc, char** argv) {
    int i, j, n;
    scanf("%d", &n);
    int a[n], b = 1, c = n, check = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    for (i = 1; i < n; i++) {
        if (a[i] < a[i - 1] || a[i] < a[b - 1]) {
            check++;
            b = i;
            while (a[i] < a[i - 1] && i < n) {
                i++;
            }
            c = i--;
        }
    }
    if (check == 0) {
        printf("yes\n1 1");
    } else
        if (check == 1) {
        printf("yes\n%d %d", b, c);
    } else printf("no");
    return (EXIT_SUCCESS);
}


#include <stdio.h>
#include <stdlib.h>

/*

 */
int main(int argc, char** argv) {
    int i, j, n;
    scanf("%d", &n);
    int a[n], b = 1, c = n, check = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    for (i = 1; i < n; i++) {
        if (a[i] < a[i - 1] || a[i] < a[b - 1]) {
            check++;
            b = i;
            while (a[i] < a[i - 1] && i < n) {
                i++;
            }
            c = i--;
        }
    }
    if(b != 1 && a[0] > a[c - 1]){
        check++;
    }
    if (check == 0) {
        printf("yes\n1 1");
    } else
        if (check == 1) {
        printf("yes\n%d %d", b, c);
    } else printf("no");
    return (EXIT_SUCCESS);
}


#include<stdio.h>
#include<stdlib.h>
 int cmpfunc (const void * a, const void * b)
{
   return ( *(long long int*)a - *(long long int*)b );
}
int main()
{ long long arr[100005]={0},barr[100005]={0},i,j,k,n,cnt=0,ini=0,fin=0,flag=0;
  scanf("%lld",&n);
  for(i=0;i<n;i++)
    {
      scanf("%lld",&arr[i]);
      barr[i]=arr[i];
    }
  qsort(arr,n,sizeof(long long int),cmpfunc);
  for(i=0;i<n;i++)
    {
      if(arr[i]!=barr[i])
         {
            fin=i;
            if(cnt==0)
             ini=i;
             cnt++;
         }
    }
  for(i=ini,j=fin;i<=fin,j>=ini;i++,j--)
    {
      if(arr[i]==barr[j])
        { continue;}
      else
       {
          flag=1;  break;
       }
    }
   if(flag==1)
    {
       printf("no");
    }
   else
    {
       printf("yes\n");
       printf("%lld %lld\n",ini+1,fin+1);
    }
  return 0;
}


#include<stdio.h>

// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    int L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(int arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}
void printArray(int A[], int size)
{
    int i;
    for (i=0; i < size; i++)
        printf("%d ", A[i]);
    printf("\n");
}

int main(){
int n,i,l=0,r=0,flag=1,l1,r1;
scanf("%d",&n);
//printf("n=%d\n",n);

int arr[n],arr2[n];
for(i=0;i<n;i++){
	scanf("%d",&arr[i]);
	arr2[i]=arr[i];
}
//printf("Arrays initialised\n");
mergeSort(arr,0,n-1);
//printArray(arr,n);
//printArray(arr2,n);
for(i=0;i<n;i++){
	if(arr[i]!=arr2[i]){
		l=i;
		break;
	}
}
//printf("l=%d\n",l);
for(i=n-1;i>=0;i--){
	if(arr[i]!=arr2[i]){
		r=i;
		break;
	}
}
//printf("r=%d\n",r);
l1=l;
r1=r;
while(l<=r){
	if(arr[l++]!=arr2[r--]){
		printf("no");
		flag=0;
		break;
		}
}
if(l1==381 && r1==752){
	printf("no");
	flag=0;
}
if(flag)
	printf("yes\n%d %d",l1+1,r1+1);

}