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>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const double eps = 1e-9;
const double PI = acos(-1);
int sgn(double a){ return a < -eps ? -1 : (a > eps ? 1 : 0); }

struct point {
    double x,y;
    point(double x=0,double y=0):x(x),y(y){}
    point operator+(const point a) const{ return {x+a.x,y+a.y}; }
    point operator-(const point a) const{ return {x-a.x,y-a.y}; }
    point operator*(const double a) const{ return {x*a,y*a}; }
    point operator/(const double a) const{ return {x/a,y/a}; }
    point operator-() const{ return *this*(-1); }
    double norm() { return x*x+y*y; }
    double abs() { return sqrt(norm()); }
    point rot90() { return point(-y,x); }
    double arg() { return atan2(y,x);}
};
istream& operator>>(istream& is,point& p){ is >> p.x >> p.y; return is; }
ostream& operator<<(ostream& os,const point& p){ os << p.x << " " << p.y; return os; }
bool operator==(point a,point b) { return !sgn(a.x-b.x) && !sgn(a.y-b.y); }
bool operator!=(point a,point b) { return !(a == b); }
double dist(point a,point b) { return (a-b).abs(); }
double dot(point a,point b) { return a.x*b.x+a.y*b.y; }
double cross(point a,point b) { return a.x*b.y-a.y*b.x; }
point mid(point a,point b) { return (a+b)/2; }
int ccw(point a,point b,point c) {
    // 1 -> c is upper than line(a,b)
    // -1 -> c is lower than line(a,b)
    // 2 -> in order [a,b,c]
    // -2 -> in order [c,a,b]
    // 0 -> in order [a,c,b]
    b = b-a,c = c-a;
    if(sgn(cross(b,c))) return sgn(cross(b,c));
    if(sgn(dot(b,c)) < 0) return -2;
    if(sgn(c.abs()-b.abs()) > 0) return 2;
    return 0;
}
struct line {
    point a,b;
    line(point a,point b):a(a),b(b) {}
    bool online(point p) { return abs(ccw(a,b,p)) != 1; }
};
struct segline {
    point a,b;
    segline(point a,point b):a(a),b(b) {}
    bool online(point p) { return !ccw(a,b,p); }
    line vertical_bisector() { return line(mid(a,b),mid(a,b)+(b-a).rot90()); }
};
bool vertical(line l,line m) { return !sgn(dot(l.a-l.b,m.a-m.b)); }
bool vertical(segline l,segline m) { return !sgn(dot(l.a-l.b,m.a-m.b)); }
bool parallel(line l,line m) { return !sgn(cross(l.a-l.b,m.a-m.b)); }
bool parallel(segline l,segline m) { return !sgn(cross(l.a-l.b,m.a-m.b)); }
bool operator==(line l,line m) { return parallel(l,m) && l.online(m.a); }
bool operator!=(line l,line m) { return !(l == m); }
bool operator==(segline l,segline m) { return l.a == m.a && l.b == m.b || l.a == m.b && l.b == m.a; }
bool operator!=(segline l,segline m) { return !(l == m); }
// intersect at one point
bool intersect(line l,line m) { return !parallel(l,m); }
bool intersect(line l,segline m) { return sgn(cross(l.b-l.a,m.a-l.a)*cross(l.b-l.a,m.b-l.a)) <= 0; }
bool intersect(segline l,segline m) {
    return ccw(l.a,l.b,m.a)*ccw(l.a,l.b,m.b) <= 0 &&
        ccw(m.a,m.b,l.a)*ccw(m.a,m.b,l.b) <= 0;
}
point intersection(line l,line m) {
    assert(intersect(l,m));
    return l.a+(l.b-l.a)*cross(m.b-m.a,m.a-l.a)/cross(m.b-m.a,l.b-l.a);
}
point intersection(line l,segline m) {
    assert(intersect(l,m));
    return l.a+(l.b-l.a)*cross(m.b-m.a,m.a-l.a)/cross(m.b-m.a,l.b-l.a);
}
point intersection(segline l,segline m) {
    assert(intersect(l,m));
    return l.a+(l.b-l.a)*cross(m.b-m.a,m.a-l.a)/cross(m.b-m.a,l.b-l.a);
}
double dist(line l,point p) { return abs(cross(l.b-l.a,p-l.a))/(l.b-l.a).abs(); }
double dist(segline l,point p) {
    if(sgn(dot(l.b-l.a,p-l.a)) < 0) return dist(p,l.a);
    if(sgn(dot(l.a-l.b,p-l.b)) < 0) return dist(p,l.b);
    return dist(line(l.a,l.b),p);
}
double dist(line l,line m) {
    if(parallel(l,m)) return dist(l,m.a);
    return 0;
}
double dist(line l,segline m) {
    if(intersect(l,m)) return 0;
    return min(dist(l,m.a),dist(l,m.b));
}
double dist(segline l,segline m) {
    if(intersect(l,m)) return 0;
    return min({dist(l,m.a),dist(l,m.b),dist(m,l.a),dist(m,l.b)});
}
point projection(line l,point p) {
    double d = dot(p-l.a,l.b-l.a)/(l.b-l.a).norm();
    return l.a+(l.b-l.a)*d;
}
point gaisin(point a,point b,point c) {
    return intersection(segline(a,b).vertical_bisector(),segline(b,c).vertical_bisector());
}
struct circle {
    point o;
    double r;
    circle(point o,double r):o(o),r(r) {}
    bool inside(point p){ return sgn(r-dist(o,p)) >= 0; }
    double area() { return r*r*PI; }
};
bool intersect(circle c,line l) { return sgn(dist(l,c.o)-c.r) <= 0; }
bool intersect(circle c,segline l) {
    if(sgn(dist(l,c.o)-c.r) > 0) return false;
    return sgn(max((c.o - l.a).abs(), (c.o - l.b).abs()) - c.r) >= 0;
}
vector<point> intersection(circle c,line l) {
    point p = projection(l,c.o);
    if(!intersect(c,l)) return {};
    if(sgn(dist(l,c.o)-c.r) == 0) return {p};
    point e = (l.b-l.a)/(l.b-l.a).abs();
    double d = sqrt(c.r*c.r-(p-c.o).norm());
    return {p-e*d,p+e*d};
}
vector<point> intersection(circle c,segline l) {
    auto v = intersection(c,line(l.a,l.b));
    vector<point> ret;
    for(point p : v) if(l.online(p)) ret.pb(p);
    return ret;
}
vector<point> intersection(circle a,circle b) {
    double d = dist(a.o,b.o);
    if(!sgn(a.r+b.r-d)) return {a.o+(b.o-a.o)*a.r/d};
    if(!sgn(a.r-b.r-d)) return {a.o+(b.o-a.o)*a.r/d};
    if(!sgn(b.r-a.r-d)) return {b.o+(a.o-b.o)*b.r/d};
    if(sgn(abs(a.r-b.r)-d) > 0 || sgn(a.r+b.r-d) < 0) return {};
    double x = (a.r*a.r+d*d-b.r*b.r)/(2*d);
    double y = sqrt(a.r*a.r-x*x);
    point p = (b.o-a.o).rot90()*y/d;
    point tomid = a.o+(b.o-a.o)*x/d;
    return {tomid+p,tomid-p};
}
vector<circle> circle_with_two_points_and_radius(point a,point b,double r) {
    if(sgn(dist(a,b)-2*r) > 0) return {};
    circle A(a,r),B(b,r);
    auto v = intersection(A,B);
    vector<circle> ret;
    for(point p : v) ret.eb(p,r);
    return ret;
};

int cnt(circle c,vector<point> &v) {
    int ret = 0;
    for(point &p : v) if(c.inside(p)) ret++;
    return ret;
}

void solve(int n) {
    vector<point> v(n);
    cin >> v;
    int ans = 1;
    for(auto p : v) for(auto q : v) {
        if(p == q) continue;
        auto can = circle_with_two_points_and_radius(p,q,1);
        for(auto &c : can) chmax(ans,cnt(c,v));
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    while(cin >> n,n) {
        solve(n);
    }
}