#include #define FOREACH(it,c) for( __typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define FOR(a,b,c) for(int a=(b);a<=(c);++a) #define ROF(a,b,c) for(int a=(b);a>=(c);--a) #define dbg(x) cout<<#x<<" = "<<(x)<<"\n"; #define pii pair #define pil pair< pair< int, int> , ind > #define mp make_pair #define pb push_back #define fi first.first #define se first.second #define ind second #define ll long long #define TATA NULL using namespace std; const int NMAX = 100002; int x[NMAX], y[NMAX], h[NMAX], cnt,mark[NMAX]; int main(){ #ifndef ONLINE_JUDGE freopen("data.in","r",stdin); #endif // ONLINE_JUDGE cin.sync_with_stdio(false); cin.tie(TATA); int n,d,m; cin >> d >> n >> m; for(int i=1;i<=n;i++) { int x; cin >> x; mark[x] = 1; } for(int i=1;i<=m;i++) cin >> x[i] >> y[i]; int sol = 0,Right; for(int i=1;i<=d;i++) { if(i <= Right) continue; for(int j=1;j<=m;j++) if(x[j] == i) h[++cnt] = j; if(mark[i] && Right < i) { int index = 0; for(int j=1;j<=cnt;j++) if(y[h[j]]>y[h[index]]) index = j; Right = y[h[index]]; h[index] = h[cnt]; cnt--; sol++; cnt = 0; } for(int j=1;j<=cnt;j++) if(y[h[j]] == i) { h[j] = h[cnt]; cnt--; j--; } } cout<