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<vector>
#include<complex>
#define EPS 0.0001
using namespace std;
typedef long double elem;
typedef complex<elem> point,vec;
inline elem dist(const point &a, const point &b){return abs(a-b);}
inline vec normr(const vec &v){return v*vec(0,-1);}
inline vec norml(const vec &v){return v*vec(0,1);}
inline vec unormr(const vec &v){return normr(v) / abs(v);}
inline vec unorml(const vec &v){return norml(v) / abs(v);}
int main(){
	while(true){
		int ans = 0;
		int n;
		scanf("%d", &n);
		if(n==0)break;
		vector< point > points;
		for(int i=0;i<n;++i){
			elem x, y;
			scanf("%Lf%Lf", &x, &y);
			points.push_back( point(x,y) );
		}
		for(unsigned int i = 0; i < points.size(); ++i){
			for(unsigned int j = 0; j < points.size(); ++j){
				if( i != j && dist( points[i], points[j] ) < 2 ){
					int count_p = 0;
					int count_q = 0;
					elem d = sqrt(1-pow(dist(points[i], points[j])/2,2 ) );
					point p,q;
					vec ab = points[j] - points[i];
					point t = (long double)0.5 * ab + points[i];  
					p = d * unormr(ab) + t;
					q = d * unorml(ab) + t;
					for(unsigned int k = 0; k < points.size(); ++k){
						if( dist(p, points[k]) <= 1.0+EPS ){ count_p++; }
						if( dist(q, points[k]) <= 1.0+EPS ){ count_q++; }
					}
					ans = max(ans, max(count_q, count_p) );
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

C++: //52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
///////////////////////////////////////////////////////////

long double add(long double a,long double b){
    if(abs(a+b) < 1e-14 * (abs(a) + abs(b))) return 0;
    else return a + b;
}
constexpr long double EPS = 1e-14;
constexpr long double PI = 3.141592653589793237462;
struct V{
    long double x,y;
    long double add(long double a,long double b){
        if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
        else return a + b;
    }
    ///////////////////////////////////////////////////
    V(long double x = 0.0,long double y = 0.0):x(x),y(y){}
    V& operator+=(const V& a){x=add(x,a.x),y=add(y,a.y);return *this;}
    V& operator-=(const V& a){x=add(x,-a.x),y=add(y,-a.y);return *this;}
    V& operator*=(const long double& a){x*=a,y*=a;return *this;}
    V  operator+(const V& b) const{V a(*this);return a+= b;}
    V  operator-(const V& b) const{V a(*this); return a-=b;}
    V  operator*(const long double& b) const{V a(*this); return a*= b;}
    bool  operator<(V& b){return getarg() > b.getarg();}
    long double dot(V b){return add(x * b.x,y * b.y);}
    long double det(V b){return add(x * b.y , -y * b.x);}
    long double norm(){return sqrt(add(x*x , y*y));}
    V  round(long double deg,bool argument = false){//弧度法で入力する時はargument = true
        long double arg = (argument ? deg : PI*(deg/180.0)) ;
        if(argument == true) arg = deg;else arg = PI * (deg / 180.0);
        return V(add(x * cos(arg),-y * sin(arg)),add(x * sin(arg),y * cos(arg)));
    }
    V get_unit(){
        return V(x / norm(),y / norm());
    }
    long double getarg(){
        return atan2(y,x);// [PI,-PI]
    }
    friend ostream& operator<<(ostream& os,V& p){
        os << fixed << setprecision(20);
        os << "(" << p.x << "," << p.y << ")";
        return os;
    }
};
struct GeoUtil{
    long double add(long double a,long double b){
        if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
        else return a + b;
    }
    long double dist(V a,V b){
        return sqrt(add(add(b.x,-a.x)*add(b.x,-a.x) , add(b.y,-a.y)*add(b.y,-a.y)));
    }
};
struct C{
    V c;
    long double r;
    C(long double x = 0.0,long double y = 0.0,long double r = 0.0):c(x,y),r(r){}
    pair<V,V> cross(const C& b){
        GeoUtil GU;
        long double r1 = r,r2 = b.r;
        V v_1 = b.c - c;
        long double d = v_1.norm();
        long double x = add(add(r1*r1,-r2*r2),d*d)/(2.0*d);
        long double ratio = x / d;
        V v_2 = v_1 * ratio;
        V p = c + v_2;
        V v_3 = v_2.round(90.0);
        v_3 = v_3.get_unit();
        long double r3 = sqrt(add(r1*r1,-x*x));
        v_3 = v_3 * r3;
        V ans1 = p + v_3;
        V ans2 = p - v_3;
        V check = ans1 - c;
        return make_pair(ans1,ans2);
    }
};
void solve(int n){
    GeoUtil GU;
    vector<C> a(n);
    rep(i,n){
        long double x,y;cin >> x >> y;
        a[i] = C(x,y,1.0);
    }
    int ans = 0;

    for(int i = 0;i < n;i++){
        C P = a[i];
        int cnt = 0;
        for(int j = 0;j < n;j++){
            if(GU.dist(P.c,a[j].c) + EPS < 1.0)cnt++;
        }
        chmax(ans,cnt);
    }
    for(int i = 0;i < n-1;i++){
        for(int j = i+1;j < n;j++){
            if(GU.dist(a[i].c,a[j].c) - EPS > 2.000)continue; 
            V P1 = a[i].cross(a[j]).first;
            V P2 = a[i].cross(a[j]).second;
            int cnt = 0;
            for(int k = 0;k < n;k++){
                if(GU.dist(P1,a[k].c) - EPS < 1.0)cnt++;
            }
            chmax(ans,cnt);
            cnt = 0;
            for(int k = 0;k < n;k++){
                if(GU.dist(P2,a[k].c) - EPS < 1.0)cnt++;
            }
            chmax(ans,cnt);
        }
    }
    cout << ans << '\n';
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    while(1){
        int n;cin >> n;
        if(n)solve(n);
        else break;
    }
    return 0;
}