1 #include"iostream"
2 #include"cstring"
3 #include"cstdio"
4 #include"algorithm"
5 using namespace std;
6 const int ms=100005;
7 int n,m,k;
8 int h[ms];
9 int cnt[ms];
10 int main()
11 {
12 int i,j,ans,p=1,k,a,b;
13 int ta,tb;
14 while(scanf("%d%d%d",&n,&m,&k)!=EOF)
15 {
16 memset(cnt,0,sizeof(cnt));
17 tb=1;
18 for(i=0;i<n;i++)
19 {
20 scanf("%d",&h[i]);
21 }
22 sort(h,h+n);
23 for(i=0;i<m;i++)
24 {
25 scanf("%d%d",&a,&b);
26 int tmpa=upper_bound(h,h+n,a)-h;
27 while(h[tmpa]>a)
28 tmpa--;
29 int tmpb=upper_bound(h,h+n,tb)-h;
30 while(h[tmpb]<=tb)
31 tmpb++;
32 tb=b;
33 cnt[tmpb]++;
34 cnt[tmpa+1]--;
35 }
36 for(i=0;i<n;i++)
37 cnt[i+1]+=cnt[i];
38 ans=0;
39 for(i=0;i<n;i++)
40 if(cnt[i]>=k)
41 ans++;
42 printf("Case %d: %d\n",p++,ans);
43 }
44 return 0;
45 }