Go: package main

import (
	"fmt"
	"math"
	"math/cmplx"
)

func main() {
	for {
		var n int
		fmt.Scan(&n)

		if n == 0 {
			return
		}

		arr := make([]complex128, n)

		for i := 0; i < n; i++ {
			var x, y float64

			fmt.Scanf("%f%f", &x, &y)

			arr[i] = complex(x, y)
		}

		max := 1
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				sub := arr[j] - arr[i]

				if cmplx.Abs(sub) >= 2 {
					continue
				}
				sum := arr[j] + arr[i]

				v := 1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

				v = -1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

			}
		}

		fmt.Println(max)
	}
}

C++: #include "bits/stdc++.h"
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

#define OUT 0
#define ON 1
#define IN 2
#define EPS 0.00009
//#define EPS (1e-10)
class P{                    //テァツつケ
public:
	double x,y;
	
	P(double _x=0,double _y=0):x(_x),y(_y){};
	P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //テ・ツ環?ァツョツ?
	P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //テヲツクツ崚ァツョツ?
	P operator * (const double k )const{ return P( x*k   , y*k    ); } //テ、ツケツ療ァツョツ?
	P operator / (const double k )const{ return P( x/k   , y/k    ); } //テゥツ卍、テァツョツ?
	
	bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
	bool operator < (const P &p) const{ return ( x!=p.x ? x<p.x:y<p.y ); }
	
	double norm(){ return x*x+y*y; }        //テ」ツδ偲」ツδォテ」ツδ?
	double abs() { return sqrt(norm()); }   //テ・ツ、ツァテ」ツ?催」ツ??
};
struct C{P p;double r;};    //テ・ツ??
struct S{P p1,p2;};         //テァツキツ堙・ツ按?
typedef vector<P> Polygon;  //テ・ツ、ツ堙ィツァツ津・ツスツ「
typedef P Vector;           //テ」ツδ凖」ツつッテ」ツδ暗」ツδォ
typedef S L;                //テァツ崢エテァツキツ?

double norm (P p)               { return p.norm(); }
double abs  (P p)               { return p.abs(); }
double dot  (Vector a,Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; }
double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}
Vector vec(S a)                 {return P(a.p2.x-a.p1.x,a.p2.y-a.p1.y);}

int ccw(P p0,P p1,P p2){    //AOJ_BOOK_P386 verified
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	
	if( cross(a,b) > EPS  ) return 1 ;      //COUNTER_CLOCKWISE
	if( cross(a,b) < -EPS ) return -1;      //CLOCKWISE
	if( dot(a,b)   < -EPS ) return 2;       //ONLINE_BACK
	if( a.norm()   < b.norm() ) return -2;  //ONLINE_FRONT
	
	return 0;                               //ON_SEGMENT;
}

//テァツ崢エテァツキツ堙ァツ崢エティツ。ツ古・ツ按、テ・ツョツ?verified AOJ0058
bool orthogonal(P p1,P p2,P p3,P p4){ return abs(dot(p1-p2,p3-p4))<EPS; }

//テァツキツ堙・ツ按?、ツコツ、テ・ツキツョテ・ツ按、テ・ツョツ?
bool intersect(P p1,P p2,P p3,P p4){ return ( ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 && ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0 ); }

//テァツキツ堙・ツ按?」ツ?ィテァツつケテ」ツ?ョティツキツ敕ゥツ崢「 verified ARC042-B
double dLP(S l, P p) { return abs(cross(l.p2-l.p1, p-l.p1)) /(l.p2-l.p1).abs(); }

//テァツキツ堙・ツ按?」ツ?ォテ・ツッツセテ」ツ?凖」ツつ凝ァツつケテ」ツ?ョテ・ツーツ?・ツスツア verified AOJ CGL_1_A
P project(S s, P p){
	Vector base = s.p2-s.p1;
	double r = dot(p-s.p1, base)/norm(base);
	return (base*r)+s.p1;
}

//テァツキツ堙・ツ按?」ツ?ォテ・ツッツセテ」ツ?凖」ツつ凝ァツつケテ」ツ?ョテ・ツ渉催・ツーツ?verified AOJ CGL_1_B
P reflect(S s,P p){ return p+(project(s,p)-p)*2.0; }

//テァツ崢エテァツキツ堙」ツ?ィテァツ崢エテァツキツ堙」ツ?ョテゥツ鳴「テ、ツソツ?verified AOJ CGL_2
int rLL(L a,L b){
	if( cross(vec(a),vec(b))==0 ) return 2; //テ、ツクツヲティツ。ツ?
	if( dot(vec(a),vec(b))==0 )   return 1; //テ・ツ楪づァツ崢エ
	return 0;
}

// テ・ツ??」ツ?ィテァツつケテ」ツ?ョテ・ツ??・ツ、ツ姪・ツ按、テ・ツョツ?
int contains(C c, P p){
	double d = (c.p-p).abs();
	if(d-c.r>EPS) return OUT;
	if(abs(d-c.r)<EPS) return ON;
	return IN;
}

//テァツ崢エテァツキツ堙」ツ?ィテ・ツ??」ツ?ョテ、ツコツ、テ・ツキツョテ・ツ按、テ・ツョツ?テゥツ?催」ツ?ェテ」ツ?」テ」ツ?ヲテ」ツ??」ツつ凝・ツ?エテ・ツ青暗」ツ?ッテ、ツコツ、テ・ツキツョテヲツ可アテ」ツ??
bool intersect_circle_(P center, double r, L line){
	if( dLP(line,center) <= r+EPS ) return true;
	return false;
}

//テァツキツ堙・ツ按?」ツ?ィテ・ツコツ療」ツ?ョティツキツ敕ゥツ崢「 verified QUPC-G
double dSP(S s, P p){
	if(dot((s.p2-s.p1)   , p-s.p1) <= EPS) return (p - s.p1).abs();
	if(dot((s.p2-s.p1)*-1, p-s.p2) <= EPS) return (p - s.p2).abs();
	return dLP(s, p);
}

//テァツキツ堙・ツ按?」ツ?ィテ・ツ??」ツ?ョテ、ツコツ、テ・ツキツョテ・ツ按、テ・ツョツ?テゥツ?催」ツ?ェテ」ツ?」テ」ツ?ヲテ」ツ??」ツつ凝・ツ?エテ・ツ青暗」ツ?ッテ、ツコツ、テ・ツキツョテヲツ可アテ」ツ?? verified QUPC-G
bool iCS(C c, S l){
	int c1 = contains(c, l.p1);
	int c2 = contains(c, l.p2);
	if(c1 > c2) swap(c1, c2);
	
	// (OUT, OUT) (OUT, ON) (OUT, IN) (ON, ON) (ON, IN) (IN, IN) テ」ツ?ョ6テゥツ?堙」ツつ?
	if(c1 == OUT && c2 == IN) return true;
	if(c1 == IN  && c2 == IN) return false;
	if(c1 == ON) return true; // (テヲツ篠・テ」ツ?凖」ツつ凝」ツ?ィテ」ツ??
	double d = dSP(l, c.p);
	if(d-c.r<-EPS) return true;
	if(d-c.r>EPS) return false;
	return true; // (テヲツ篠・テ」ツ?凖」ツつ凝」ツ?ィテ」ツ??
}

//テ・ツ債佚ァツエツ氾・ツ、ツ堙ィツァツ津・ツスツ「テ・ツ按、テ・ツョツ?
bool isSimple( Polygon pol ){
	//テ・ツ按敕」ツつ?」ツ?ョテァツつケテ」ツつ津ゥツ?催ィツ、ツ?」ツ?療」ツ?ヲpolテ」ツ?ォテ・ツ?・テ」ツつ古」ツ?ヲテ」ツ?甘」ツ??
	size_t pol_size = pol.size()-1;
	rep(i,pol_size){
		for(int j=i+2;j<pol_size;j++){
			if( i==j || i==(j-1+pol_size)%pol_size || i==(j+1+pol_size)%pol_size )continue;
			if( intersect(pol[i], pol[i+1], pol[j], pol[j+1]) )return false;
		}
	}
	return true;
}

//テァツつケテ」ツ?古・ツ?クテ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ョテ・ツ??・ツ?エテ」ツ?ォテ」ツ?づ」ツつ凝」ツ?凝」ツ?ゥテ」ツ??」ツ?凝」ツつ津ヲツアツづ」ツつ?」ツつ?trueテ」ツ?ェテ」ツつ嘉・ツ??・ツ?エ verified AOJ0012
int isPointInsidePolygon(vector<P> pol,P p){
	int c=0;
	rep(i,pol.size()){
		if( cross(pol[i]-pol[(i+1)%pol.size()] , p-pol[(i+1)%pol.size()])==0 ) return ON;
		if( cross(pol[i]-pol[(i+1)%pol.size()] , p-pol[(i+1)%pol.size()])>0 ) c++;
	}
	if( c%pol.size() )return OUT;
	return IN;
}

//テ・ツ??」ツ?ィテ・ツ?クテ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ョテ、ツコツ、テ・ツキツョテァツ環カテヲツ?凝」ツつ津ィツェツソテ」ツ?ケテ」ツつ?
int CPOLarea(C c ,Polygon pol){
	vector<L> lines;
	vector<int> res(pol.size());
	bool POLinC=true, isFar=true;
	
	rep(i,pol.size()){
		if( contains(c,pol[i])==OUT )POLinC=false;
		res[i] = contains(c,pol[i]);
		lines.pb( L{ pol[i] , pol[(i+1)%pol.size()] });
		if( sqDist(c.p,pol[i])<c.r*c.r )isFar=false;
	}
	
	if( POLinC )                                        return 2;   //テ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ッテ・ツ??」ツ?ョテ・ツ??ゥツδィb
	if( isPointInsidePolygon(pol, c.p)==IN && isFar )   return 3;   //テ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ョテ・ツ??ゥツδィテ」ツ?ォテ・ツ??
	rep(i,lines.size()) if( iCS(c,lines[i]) )           return 1;   //テ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ィテ・ツ??」ツ?ッテ、ツコツ、テ・ツキツョc
	return 0;
}

//テ・ツ?クテ・ツ個?verified AOJ0068,QUPC-G
//ティツセツ榲ヲツ崢クテゥツ??」ツ?ァテヲツッツ氾ィツシツ?
bool cmp_x(const P& p, const P& q){
	if(p.x != q.x)return p.x<q.x;
	return p.y<q.y;
}

//テ・ツ?クテ・ツ個?」ツつ津ヲツアツづ」ツつ?」ツつ?
vector<P> convex_hull(vector<P> ps){
	int n = ps.size();
	sort(all(ps),cmp_x);
	int k=0;            //テ・ツ?クテ・ツ個?」ツ?ョテゥツ?づァツつケテヲツ閉ー
	vector<P> qs(n*2);  //テヲツァツ凝ヲツ按静、ツクツュテ」ツ?ョテ・ツ?クテ・ツ個?
	//テ、ツクツ凝・ツ?エテ・ツ?クテ・ツ個?」ツ?ョテ、ツスツ愿ヲツ按?
	rep(i,n){
		while( k>1 && cross((qs[k-1]-qs[k-2]) , (ps[i]-qs[k-1]))<=0 ) k--;
		qs[k++]=ps[i];
	}
	//テ、ツクツ甘・ツ?エテ・ツ?クテ・ツ個?」ツ?ョテ、ツスツ愿ヲツ按?
	for(int i=n-2, t=k;i>=0;i--){
		while( k>t && cross((qs[k-1]-qs[k-2]) , (ps[i]-qs[k-1]))<=0 ) k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}


//2テァツつケテ」ツつ津ゥツ?堙」ツつ凝・ツ債甘・ツセツвテ」ツ?ョテ・ツ??」ツ?ョテ、ツクツュテ・ツソツε・ツコツァテヲツィツ凖」ツつ津ヲツアツづ」ツつ?」ツつ?
pair<P,P> geoGetCircleOf2pAndR(P p1,P p2,double r){
	P pc1=P(-INF,-INF), pc2(-INF,-INF), p3;
	double d, l, dx, dy ;
	
	p3 = (p1+p2)/2.0;
	l = sqDist(p2,p3);
	
	if  (r*r >= l) {
		d  = sqrt(r*r / l - 1.0) ;
		dx = d * (p2.y - p3.y) ;
		dy = d * (p2.x - p3.x) ;
		
		pc1.x = p3.x + dx ;
		pc1.y = p3.y - dy ;
		
		pc2.x = p3.x - dx ;
		pc2.y = p3.y + dy ;
	}
	return pair<P,P>(pc1,pc2);
}


int main(){
	int n;
	while(cin>>n&&n){
		int ans=0;
		vector<P> ps(n);
		rep(i,n)cin>>ps[i].x>>ps[i].y;
		
		rep(i,n){
			for(int j=i+1;j<n;j++){
				if(dist(ps[i],ps[j])>2+EPS)continue;
				pair<P,P> res = geoGetCircleOf2pAndR(ps[i],ps[j],1);
				int suma=0,sumb=0;
				rep(k,n){
					if(sqDist(ps[k],res.first )<1+EPS)suma++;
					if(sqDist(ps[k],res.second)<1+EPS)sumb++;
				}
				ans = max(ans,max(suma,sumb));
			}
		}
		cout<<ans<<endl;
	}
}