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>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double R;//double long double ??????????????? cmath?????¢??°??????????????????????????????????????????????????§????????????
typedef complex<R> Point;
typedef pair<Point , Point> Line;
typedef pair<Point ,R > Circle;
typedef vector<Point> Poly;

#define EPS (1e-10)//??????
#define EQ(a,b) (abs((a)-(b)) < EPS)//??????????????°???????????????
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )//????????????????????????????????????
#define ft first
#define sd second
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

R dot(Point a,Point b){//??????ok
    return (a.real() * b.real() + a.imag() * b.imag());
}
R cross(Point a,Point b){//??????ok
    return (a.real() * b.imag() - a.imag() * b.real());
}




bool is_orthogonal(Line a,Line b){//2??´????????´?????????ok
    return EQ(dot(a.ft - a.sd,b.ft - b.sd),0.0);
}
bool is_parallel(Line a,Line b){//2??´??????????????????ok
    return EQ(cross(a.ft - a.sd,b.ft - b.sd),0.0);
}



////////////////////????????????
int ccw(Point a,Point b,Point c){//ok
    b -= a; c -= a;
    if(cross(b,c) > EPS) return 1;//a???b??§???????¨???¨???????????????b???c
    if(cross(b,c) < -EPS) return -1;//a???b??§????¨???¨???????????????b???c
    if(dot(b,c) < -EPS) return 2;//c--a--b on same line
    if(norm(c) - norm(b) > EPS) return -2;//a--b--c(abs??????????????????????????????????????????????????????????)
    return 0;//a--c--b?????????b==c
}

bool is_intersection_ll(Line l,Line m){//???????????´??????????????????ok
    return abs(cross(l.sd - l.ft,m.sd - m.ft)) > EPS || //????????§??????
        abs(cross(l.sd - l.ft,m.ft - l.ft)) < EPS; //?????????????????????
}

bool is_intersection_ls(Line l,Line s){//??´???l??¨??????s???????????????
    return cross(l.sd - l.ft, s.ft-l.ft)*       // s[0] is left of l
        cross(l.sd - l.ft, s.sd - l.ft) < EPS; // s[1] is right of l
}

bool is_intersection_lp(Line l,Point p){//??´???l??¨???p???????????????
    return abs(cross(l.sd - p,l.ft - p));
}

bool is_intersection_ss(Line a,Line b){//??????????????????????????????ok
    return ccw(a.ft,a.sd,b.ft)*ccw(a.ft,a.sd,b.sd) <= 0 && ccw(b.ft,b.sd,a.ft)*ccw(b.ft,b.sd,a.sd) <= 0;
}

bool is_intersection_sp(Line s,Point p){//????????¨?????????????????? ????§??????????????????¨
    return abs(s.ft - p) + abs(s.sd - p) - abs(s.ft - s.sd) < EPS;
}


bool intersection_cc(Circle c1,Circle c2){//???????????????????????????ok
    return abs(c1.ft - c2.ft) - (c1.sd + c2.sd) < -EPS;
}


/////////////?????¢
R dis_lp(Line l,Point p){//??´???l??¨???p????????¢ok
    return abs(cross(l.sd - l.ft,p - l.ft)) / abs(l.sd - l.ft);
}

R dis_ll(Line l,Line m){//???????????´???????????¢
    return is_intersection_ll(l,m) ? 0.0 : dis_lp(l,m.ft);
}

R dis_ls(Line l,Line s){//??´???l??¨??????s????????¢
    if(is_intersection_ls(l,s)) return 0.0;
    return min(dis_lp(l,s.ft),dis_lp(l,s.sd));
}

R dis_sp(Line s,Point p){//??????s??¨???p????????¢ok
    if(dot(s.sd - s.ft,p - s.ft) < EPS) return abs(p - s.ft);
    if(dot(s.ft - s.sd,p - s.sd) < EPS) return abs(p - s.sd);
    return dis_lp(s,p);
}

R dis_ss(Line s,Line t){//???????????????????????¢ok
    if(is_intersection_ss(s,t)) return 0.0;
    return min(min(dis_sp(s,t.ft),dis_sp(s,t.sd)),
            min(dis_sp(t,s.ft),dis_sp(t,s.sd)));
}



//////////////?°???±??¨????°?
Point projection(Line l,Point p){//?°???±????±???????ok
    R t = dot(p - l.ft,l.ft - l.sd) / norm(l.ft - l.sd);
    return l.ft + t * (l.ft - l.sd);
}

Point reflection(Line l,Point p){//????°?????±???????ok
    return p + (R)2.0 * (projection(l,p) - p);
}




//////////////??????(????????????????¨???????????????¨??????????????????????????????????????£??????)

Point intersection_ll(Line l,Line m){//????????????????????????????????????????????????ok
    R A = cross(l.sd - l.ft,m.sd - m.ft);
    R B = cross(l.sd - l.ft,l.sd - m.ft);
    if(abs(A) < EPS && abs(B) < EPS) return m.ft;//?????????
    //if(abs(A) < EPS)assert(false);//????????§????????????
    return m.ft + B / A * (m.sd - m.ft);
}

Line intersection_of_two_circles(Circle c1,Circle c2){//ok ????????????????????????Line?????\????????????(r1 + r2 > sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2))???????????????????????????ok
    R a =  abs(c2.ft - c1.ft);
    R b = c1.sd;
    R c = c2.sd;

    R rc = (a  * a + b * b - c * c) / (2.0 * a);
    R rs = sqrt(b * b - rc * rc);//C++ ??§???????????????????????????????????§???????????????sqrt ????????? float ?????????????????? long double ????????????????????????????????????????????¨?????§???????????? C ????????°????????§??????sqrt ????????? double ??????????????£??????????????????
    Point diff = (c2.ft - c1.ft) / a;

    Line p ;
    p.ft = c1.ft + diff * rc + diff * Point(0,1) * rs;
    p.sd = c1.ft + diff * rc + diff * Point(0,-1) * rs;

    return p;
}


/////////////////////////polygon

#define currP(P,i) P[(i) % P.size()]//????????????
#define nextP(P,i) P[((i) + 1)%P.size()]//?¬??????????

int is_contains_p_in_Poly(Poly po,Point p){//??????????§???¢????????¨(1)????¢????(-1)????????¨(0)??????????????????????????????ok
    bool in = false;
    REP(i,po.size()){
        Point a = currP(po,i) - p,b = nextP(po,i) - p;
        if(a.imag() > b.imag())swap(a,b);
        if(a.imag() < EPS && EPS < b.imag())
            if(cross(a,b) < -EPS) in = !in;
        if(EQ(cross(a,b),0.0) && dot(a,b) < EPS)return  -1;
    }
    return in;
}

R area2(Poly po){//????§???¢?????¢????????????????±???????ok
    R A = 0.0;
    REP(i,po.size())
        A += cross(currP(po,i),nextP(po, i));
    return A;
}




///////////////////////////???

bool comp_complex_real(Point a,Point b){//x???y????????????ok
    if(EQ(a.real(),b.real()))
        return b.imag() - a.imag() > EPS;
    return b.real() - a.real() > EPS;
}

Poly convex_hull(Poly ps){//??????ok
    int n = ps.size(),k = 0;
    sort(ps.begin(),ps.end(),comp_complex_real);
    Poly ch(2*n);
    for(int i = 0;i < n;ch[k++] = ps[i++])// lower-hull
        while(k >= 2 && ccw(ch[k - 2],ch[k - 1],ps[i]) <= 0 && ccw(ch[k - 2],ch[k - 1],ps[i]) > -2) --k;//?????????????????¶???180??????????????¨???????????????
    for(int i = n - 2,t = k + 1;i >= 0;ch[k++] = ps[i--])//upper-hull
        while(k >= t && ccw(ch[k - 2],ch[k - 1],ps[i]) <= 0 && ccw(ch[k - 2],ch[k - 1],ps[i]) > -2) --k;//????????????
    ch.resize(k - 1);
    return ch;
}
#define prevP(P, i) P[(i+P.size()-1) % P.size()]
bool isconvex(Poly P){//?????§??????????¨??????????????¨???¨????????????
    bool cl = false,ccl = false;
    for(int i = 0;i < P.size();++i){
        int c = ccw(prevP(P,i),currP(P,i),nextP(P,i));
        if(c == -2)continue;//180??????????????¨????????????360??????????????¨??????c == -2 || c == 0
        if(c == 1)ccl = true;
        else if(c == 2)cl = true;
        else return false;
    }
    return !(cl && ccl);
}

#define MAX_N 300 
int n;
vector<int> G[MAX_N];

Point p[MAX_N];

bool input(){
    cin >> n;
    REP(i,n){
        R x,y;
        cin >> x >> y;
        p[i] = Point(x,y);
    }
}
bool use[MAX_N];
bool use2[MAX_N];
void solve(){
    REP(i,n)G[i].clear();
    REP(i,n){
        FOR(j,i+1,n){
            if(abs(p[i] - p[j]) - 2.0 < EPS){
                G[i].pb(j);
                G[j].pb(i);
            }
        }
    }
    
    int maxi = 0;
    REP(i,n){
        fill(use,use+n,false);
        use[i] = true;
        REP(j,G[i].size()){
            use[G[i][j]] = true;
        }
        REP(j,G[i].size()){
            int k = G[i][j];
            fill(use2,use2+n,false);
            use2[k] = true;
            REP(l,G[k].size())
                use2[G[k][l]] = true;
            REP(l,n){
                use[l] = (use[l] && use2[l]);
            }
        }
        int sum = 0;
        REP(j,n){
            sum += use[j];
        }
        maxi = max(maxi,sum);
    }
    printf("%d\n",maxi);
}

int main(){
    while(input()){
        solve();
    }
    return 0;
}