#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<sstream>
#include<string>
#include<string.h>
#include<deque>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<map>
#include<set>

using namespace std;

typedef long long LL;
typedef pair<int,int> pii;

double PI = acos(-1);
double EPS = 1e-7;
int INF = 1000000000;
int MAXINT = 2147483647;
LL INFLL = 1000000000000000000LL;
LL MAXLL = 9223372036854775807LL;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define SIZE(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define RESET(a,b) memset(a,b,sizeof(a))
#define FOR(a,b,c) for (int (a)=(b); (a)<=(c); (a)++)
#define FORD(a,b,c) for (int (a)=(b); (a)>=(c); (a)--)
#define FORIT(a,b) for (__typeof((b).begin()) a=(b).begin(); a!=(b).end(); (a)++)
#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))
#define PAUSE system("pause")

#define input(in) freopen(in,"r",stdin)
#define output(out) freopen(out,"w",stdout)

inline void inp(int &num)
{
	bool neg=0;
	num=0;
	char c;
	while ((c=getchar_unlocked()) && (!isdigit(c) && c!='-'));
	if (c=='-')
	{
		neg=1;
		c=getchar_unlocked();
	}
	do num=num*10+c-'0';
	while ((c=getchar_unlocked()) && isdigit(c));
	num*=(neg)?-1:1;
} 

/*\   \
\   \*/



vector<pii> ls[400005];
vector<int> rt[400005];
pair<pii,int> p[100005];

vector<pii> loc[100005];

inline void merge(int id,vector<pii> &res,vector<pii> &a,vector<pii> &b)
{
	int la = 0;
	int lb = 0;
	int sa = SIZE(a);
	int sb = SIZE(b);
	while(la < sa || lb < sb)
	{
		if (la >= sa) {res.pb(b[lb]);loc[b[lb].se].pb(mp(id,SIZE(res)-1));lb++;}
		else if (lb >= sb) {res.pb(a[la]);loc[a[la].se].pb(mp(id,SIZE(res)-1));la++;}
		else
		{
			if (a[la] < b[lb]) {res.pb(a[la]);loc[a[la].se].pb(mp(id,SIZE(res)-1));la++;}
			else {res.pb(b[lb]);loc[b[lb].se].pb(mp(id,SIZE(res)-1));lb++;}
		}
	}
}


inline void build_x(int n,int l,int r)
{
	if (l == r)
	{
		ls[n].clear();
		ls[n].pb(mp(p[l].fi.se,p[l].se));
		rt[n].assign(SIZE(ls[n])<<2,0);
		loc[p[l].se].pb(mp(n,0));
		return;
	}
	int m = (l+r)>>1;
	build_x((n<<1),l,m);
	build_x((n<<1)+1,m+1,r);
	ls[n].clear();
	merge(n,ls[n],ls[(n<<1)],ls[(n<<1)+1]);
	rt[n].assign(SIZE(ls[n])<<2,0);
}

inline int query_y(int nx,int n,int l,int r,int ly,int ry)
{
	if (ly > ls[nx][r].fi || ry < ls[nx][l].fi) return 0;
	if (ly <= ls[nx][l].fi && ls[nx][r].fi <= ry)
	{
		return rt[nx][n];
	}
	int res = 0;
	int m = (l+r)>>1;
	if (ly <= ls[nx][m].fi) MAX(res,query_y(nx,(n<<1),l,m,ly,min(ls[nx][m].fi,ry)));
	if (ls[nx][m+1].fi <= ry) MAX(res,query_y(nx,(n<<1)+1,m+1,r,max(ls[nx][m+1].fi,ly),ry));
	return res;
}


inline int query_x(int n,int l,int r,int lx,int rx,int ly,int ry)
{
	if (lx > p[r].fi.fi || rx < p[l].fi.fi) return 0;
	if (lx <= p[l].fi.fi && p[r].fi.fi <= rx)
	{
		return query_y(n,1,0,SIZE(ls[n])-1,ly,ry);
	}
	int res = 0;
	int m = (l+r)>>1;
	if (lx <= p[m].fi.fi) MAX(res,query_x((n<<1),l,m,lx,min(p[m].fi.fi,rx),ly,ry));
	if (p[m+1].fi.fi <= rx) MAX(res,query_x((n<<1)+1,m+1,r,max(p[m+1].fi.fi,lx),rx,ly,ry));
	return res;
}


inline void update_y(int nx,int n,int l,int r,int fy,int v)
{
	if (l == r)
	{
		MAX(rt[nx][n],v);
		return;
	}
	int m = (l+r)>>1;
	if (fy <= m) update_y(nx,(n<<1),l,m,fy,v);
	else update_y(nx,(n<<1)+1,m+1,r,fy,v);
	rt[nx][n] = max(rt[nx][(n<<1)],rt[nx][(n<<1)+1]);
}

int main()
{
	int t;
	t=10;
	FOR(tc,1,t)
	{
		int n;
		n = 100000;
		pair<pair<pii,pii>,int> d[100005];
		FOR(a,1,n)
		{
			d[a].fi.se.fi= 1;
			d[a].fi.se.se= 1000000;
			d[a].fi.fi.fi= 1000000-a;
			d[a].fi.fi.se= 100;
			
			loc[a].clear();
			d[a].se = a;
			p[a-1] = mp(mp(d[a].fi.se.fi+d[a].fi.se.se,d[a].fi.se.fi-d[a].fi.se.se),a);
		}

		sort(p,p+n);
		sort(d+1,d+n+1);

		build_x(1,0,n-1);
		
		
		int ans = 0;
		FOR(a,1,n)
		{
			int w = d[a].fi.fi.se;
			int x = d[a].fi.se.fi;
			int y = d[a].fi.se.se;
			int id = d[a].se;
			int val = query_x(1,0,n-1,x+y-w,x+y+w,x-y-w,x-y+w);
			FOR(b,0,SIZE(loc[id])-1)
			{
				update_y(loc[id][b].fi,1,0,SIZE(ls[loc[id][b].fi])-1,loc[id][b].se,val+1);
			}
			MAX(ans,val+1);
		}
		printf("Case %d: %d\n",tc,ans);
	}
}