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 <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

typedef complex<double> P;
const double PI = 3.14159265;
const double eps = 1e-7;

inline double dist(const P &p,const P &q) {
    double dx = (p-q).real(),dy = (p-q).imag();
    return sqrt(dx*dx+dy*dy);
}

double inner(const P &p,const P &q) {
    return (conj(p)*q).real();
}

double outer(const P &p,const P &q) {
    return (conj(p)*q).imag();
}

struct Line {
    P pos,dir;
    Line(const P &p,const P &q) : pos(p), dir(q) {;}
};

// rotate to right , radian
P rotate(const P &p,double degree) {
    return P(p.real()*cos(degree)+p.imag()*(-sin(degree)),
             p.real()*sin(degree)+p.imag()*cos(degree));
}

struct Circle {
    double r;
    P c;
    Circle(P c,double r) : c(c), r(r) {;}
};

// p in C?
inline bool inC(const Circle &c,const P &p) {
    return dist(c.c,p) < c.r + eps;
}

pair<P,P> findCenter(P &p1,P &p2) {
    P cp = p1+p2;
    cp /= 2;

//    cout<<"cp = "<<cp<<endl;
    P od = p2-cp;

//    cout<<"original od = "<<od<<endl;
    od = rotate(od,PI/2);
//    cout<<"rotated od = "<<od<<endl;

    double abod = abs(od),abcp = norm(cp-p1);
    double len = sqrt(1-abcp);

    // cout<<"abod = "<<abod<<" abcp = "<<abcp<<endl;
    // cout<<"len = "<<len<<endl;
    P rep1 = cp + (od/abod)*len;
    P rep2 = cp - (od/abod)*len;
    return make_pair(rep1,rep2);
}

int main() {
    int n;
    while(cin>>n, n) {
        vector<P> pv;
        double x,y;
        for(int i=0; i<n; ++i) {
            cin>>x>>y;
            pv.push_back(P(x,y));
        }

        int ans = 1;
        for(int i=0; i<n; ++i) {
            for(int j=i+1; j<n; ++j) {
                if(dist(pv[i],pv[j]) > 2.0) continue;
                pair<P,P> p = findCenter(pv[i],pv[j]);
                int t1 = 0,t2 = 0;
//                cout<<pv[i]<<" "<<pv[j]<<" "<<p.first<<" "<<p.second<<endl;
                Circle c1(p.first,1.0);
                Circle c2(p.second,1.0);
                for(int k=0; k<n; ++k) {
                    if(inC(c1,pv[k])) t1++;
                    if(inC(c2,pv[k])) t2++;
                }
                ans = max(ans, max(t1,t2));
            }
        }

        cout<<ans<<endl;
    }
}