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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (typeof((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(typeof(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



const double INF = 1e10;
const double EPS = 1e-4;
const double PI = acos(-1.0);
double torad(int deg) {return (double)(deg) * PI / 180;}

struct Point {
    double x, y;
    Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}
    friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};

Point operator + (Point p, Point q) {return Point(p.x + q.x, p.y + q.y);}
Point operator - (Point p, Point q) {return Point(p.x - q.x, p.y - q.y);}
Point operator * (Point p, double a) {return Point(p.x * a, p.y * a);}
Point operator * (double a, Point p) {return Point(a * p.x, a * p.y);}
Point operator * (Point p, Point q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
Point operator / (Point p, double a) {return Point(p.x / a, p.y / a);}
Point conj(Point p) {return Point(p.x, -p.y);}
Point rot(Point p, double ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
Point rot90(Point p) {return Point(-p.y, p.x);}
double cross(Point p, Point q) {return p.x * q.y - p.y * q.x;}
double dot(Point p, Point q) {return p.x * q.x + p.y * q.y;}
double norm(Point p) {return dot(p, p);}
double abs(Point p) {return sqrt(dot(p, p));}
bool eq(Point p, Point q) {return abs(p - q) < EPS;}
double amp(Point p) {double res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;}
Point operator / (Point p, Point q) {return p * conj(q) / norm(q);}


struct Line : vector<Point> {
    Line(Point a = Point(0.0, 0.0), Point b = Point(0.0, 0.0)) {
        this->push_back(a);
        this->push_back(b);
    }
};


struct Circle : Point{
    double r;
    Circle(Point p = Point(0.0, 0.0), double r = 0.0) : Point(p), r(r) {}
};


Point proj(Point p, Line l) {
    double t = dot(p - l[0], l[1] - l[0]) / norm(l[1] - l[0]);
    return l[0] + (l[1] - l[0]) * t;
}

double distance(Point p, Line l) {
    return abs(p - proj(p, l));
}

vector<Point> crosspoint(Line l, Line m) {
    vector<Point> res;
    double d = cross(m[1] - m[0], l[1] - l[0]);
    if (abs(d) < EPS) return vector<Point>();
    res.PB(l[0] + (l[1] - l[0]) * cross(m[1] - m[0], m[1] - l[0]) / d);
    return res;
}

vector<Point> crosspoint(Circle e, Circle f) {
    vector<Point> res;
    double d = abs(e - f);
    if (d < EPS || d > e.r + f.r + EPS) return vector<Point>();
    double rcos = (d * d + e.r * e.r - f.r * f.r) / (2.0 * d);
    double rsin = sqrt(e.r * e.r - rcos * rcos);
    Point dir = (f - e) / d;
    Point p1 = e + dir * Point(rcos, rsin);
    Point p2 = e + dir * Point(rcos, -rsin);
    res.push_back(p1);
    if (!eq(p1, p2)) res.push_back(p2);
    return res;
}

vector<Point> crosspoint(Circle e, Line l) {
    vector<Point> res;
    Point p = proj(e, l);
    double rcos = abs(e - p);
    if (rcos > e.r + EPS) return vector<Point>();
    double rsin = sqrt(e.r * e.r - rcos * rcos);
    Point dir = (l[1] - l[0]) / abs(l[1] - l[0]);
    Point p1 = p + dir * rsin;
    Point p2 = p - dir * rsin;
    res.push_back(p1);
    if (!eq(p1, p2)) res.push_back(p2);
    return res;
}



int main() {
    //freopen( "/Users/macuser/Documents/Programming/Contest/input.in", "r", stdin );
    
    int N;
    while (cin >> N) {
        if (N == 0) break;
        
        vector<Point> vp(N);
        for (int i = 0; i < N; ++i) cin >> vp[i].x >> vp[i].y;
        
        int res = 1;
        for (int i = 0; i < N; ++i) {
            for (int j = i+1; j < N; ++j) {
                double dis = abs(vp[i] - vp[j])/2;
                
                if (dis > 1.0 + EPS) continue;
                
                Circle c1(vp[i], 1.0), c2(vp[j], 1.0);
                vector<Point> c = crosspoint(c1, c2);
                
                //cout << i << ", " << j << " : " << dis << ", " << c1 << ", " << c2 << ", " << c;
                
                for (int k = 0; k < c.size(); ++k) {
                    Circle alt(c[k], 1.0);
                    
                    int con = 0;
                    for (int l = 0; l < N; ++l) {
                        double kyori = abs(vp[l]-c[k]);
                        if (kyori < 1.0 + EPS) ++con;
                    }
                    
                    //cout << alt << ", " << con << endl;
                    
                    res = max(res, con);
                }
            }
        }
        
        cout << res << endl;
    }
    
    return 0;
}