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++: #pragma GCC optimize ("O3")

using namespace std;

#include <bits/stdc++.h>

using QWORD  = uint64_t;
using SQWORD = int64_t;
using DWORD  = uint32_t;
using SDWORD = int32_t;
using WORD   = uint16_t;
using SWORD  = int16_t;
using BYTE   = uint8_t;
using SBYTE  = int8_t;
using DOUBLE = double;
using FLOAT  = float;

#define MIN_SDWORD (-2147483648)
#define MAX_SDWORD (2147483647)
#define MIN_SBYTE (-128)
#define MAX_SBYTE (127)

#define MIN_SQWORD (0x8000000000000000)
#define MAX_SQWORD (0x7FFFFFFFFFFFFFFF)

#define MAX_QWORD  (0xFFFFFFFFFFFFFFFF)
#define MAX_DWORD  (0xFFFFFFFF)
#define MAX_WORD   (0xFFFF)
#define MAX_BYTE   (0xFF)

#define MAX_DOUBLE      (1.0e+308)
#define DOUBLE_EPS      (1.0e-12)
#define MIN_DOUBLE_N    (-1.0e+308)

#define ArrayLength(a)  (sizeof(a) / sizeof(a[0]))

static inline DOUBLE MAX(DOUBLE a, DOUBLE b) { return a > b ? a : b; }
static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; }
static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; }
static inline SDWORD MAX(SDWORD a, SDWORD b) { return a > b ? a : b; }
static inline DOUBLE MIN(DOUBLE a, DOUBLE b) { return a < b ? a : b; }
static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; }
static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; }
static inline SDWORD MIN(SDWORD a, SDWORD b) { return a < b ? a : b; }

#define BYTE_BITS   (8)
#define WORD_BITS   (16)
#define DWORD_BITS  (32)
#define QWORD_BITS  (64)

static const DOUBLE d_PI = 3.14159265358979323846;

static inline void inputStringSpSeparated(char *pcStr)
{
    char *pcCur = pcStr;
    for (;;) {
        char c = getchar();
        if (('\n' == c) || (EOF == c) || (' ' == c)) {
            break;
        }
        *pcCur = c;
        pcCur++;
    }
    *pcCur = '\0';
}

static inline void inputString(char *pcStr)
{
    char *pcCur = pcStr;
    for (;;) {
        char c = getchar();
        if (('\n' == c) || (EOF == c)) {
            break;
        }
        *pcCur = c;
        pcCur++;
    }
    *pcCur = '\0';
}


static inline SQWORD inputSQWORD(void)
{
    SQWORD sqNumber = 0;
    SQWORD sqMultiplier = 1;
    bool bRead = false;
    for (;;) {
        char c = getchar();
        if (!bRead) {
            if ('-' == c) {
                sqMultiplier = -1;
            }
        }
        if (('0' <= c) && (c <= '9')) {
            sqNumber *= 10LL;
            sqNumber += (SQWORD)(c - '0');
            bRead = true;
        } else {
            if (bRead) {
                return sqNumber * sqMultiplier;
            }
        }
    }
}


static inline SDWORD inputSDWORD(void)
{
    SDWORD lNumber = 0;
    SDWORD lMultiplier = 1;
    bool bRead = false;
    for (;;) {
        char c = getchar();
        if (!bRead) {
            if ('-' == c) {
                lMultiplier = -1;
            }
        }
        if (('0' <= c) && (c <= '9')) {
            lNumber *= 10;
            lNumber += (c - '0');
            bRead = true;
        } else {
            if (bRead) {
                return lNumber * lMultiplier;
            }
        }
    }
}

static inline DOUBLE inputFP(void)
{
    DOUBLE dInt = 0.0;
    DOUBLE dFrac = 0.0;
    DOUBLE dMultiplier = 1.0;
    DWORD dwFpCnt = 0;
    DOUBLE *pdCur = &dInt;
    bool bRead = false;
    for (;;) {
        char c = getchar();
        if (!bRead) {
            if ('-' == c) {
                dMultiplier = -1;
            }
        }
        if ('.' == c) {
            pdCur = &dFrac;
        } else if (('0' <= c) && (c <= '9')) {
            (*pdCur) *= 10;
            (*pdCur) += (DOUBLE)(c - '0');
            bRead = true;
            if (pdCur == &dFrac) {
                dwFpCnt++;
            }
        } else {
            if (bRead) {
                return dMultiplier * (dInt + dFrac / (pow((DOUBLE)10.0 , (DOUBLE)dwFpCnt)));
            }
        }
    }
}

/*----------------------------------------------*/


/*----------------------------------------------*/

struct VECTOR_2D {
    DOUBLE dX;
    DOUBLE dY;
    VECTOR_2D(DOUBLE x, DOUBLE y) : dX(x), dY(y) {};
    VECTOR_2D() : dX(0), dY(0) {};

	VECTOR_2D& operator-= (const VECTOR_2D a)
    { 
        dX = dX - a.dX;
        dY = dY - a.dY;
        return *this;
    };
    const VECTOR_2D operator- (const VECTOR_2D a) const {
		return VECTOR_2D(dX - a.dX, dY - a.dY);
    };

    DOUBLE norm(void)
    {
        return (dX * dX + dY * dY);
    }

    DOUBLE dist(void)
    {
        return sqrt(norm());
    }

    DOUBLE angle(void)
    {
        return atan2(dY, dX);
    }
};


struct PROBLEM_ONE {
    SQWORD sqN;
    vector<VECTOR_2D> vecCenter;
};

static DOUBLE normalizeAngle(DOUBLE dAngle)
{
    DOUBLE dRet = dAngle;
    while (dRet < 0.0) {
        dRet += (2.0 * d_PI);
    }

    while ((2.0 * d_PI) < dRet) {
        dRet -= (2.0 * d_PI);
    }

    return dRet;
}


enum PNT_EVENT_TYPE {
    PNT_EVENT_ADD = 0,
    PNT_EVENT_SUB
};

struct INTERSECTION {
    DOUBLE dAngle;
    SQWORD sqCircleIdx;
    PNT_EVENT_TYPE  eEv;

    INTERSECTION(DOUBLE d, SQWORD idx, PNT_EVENT_TYPE e): dAngle(d), sqCircleIdx(idx), eEv(e) {};
};

bool operator< (const INTERSECTION &a, const INTERSECTION &b)
{
    return a.dAngle < b.dAngle;
}


static void solve(PROBLEM_ONE &stPro) {

    SQWORD sqMaxIntersect = 0;

    for (SDWORD sqBaseIdx = 0; sqBaseIdx < stPro.sqN; sqBaseIdx++) {
        VECTOR_2D stBase = stPro.vecCenter[sqBaseIdx];
        vector<INTERSECTION> vecstIntersection;

        for (SQWORD sqTgtIdx = 0; sqTgtIdx < stPro.sqN; sqTgtIdx++) {
            VECTOR_2D stTgt = stPro.vecCenter[sqTgtIdx];
            if (sqTgtIdx != sqBaseIdx) {
                VECTOR_2D stRel = stTgt - stBase;
                DOUBLE dDist = stRel.dist();

                if (dDist < 2.0) {
                    DOUBLE dCenterAngle = stRel.angle();
                    DOUBLE dRelAngle = acos(dDist / 2.0);
                    DOUBLE dAngle1 = normalizeAngle(dCenterAngle - dRelAngle);
                    DOUBLE dAngle2 = normalizeAngle(dCenterAngle + dRelAngle);

                    vecstIntersection.push_back(INTERSECTION{dAngle1, sqTgtIdx, PNT_EVENT_ADD});
                    vecstIntersection.push_back(INTERSECTION{dAngle2, sqTgtIdx, PNT_EVENT_SUB});
                }
            }
        }
        sort(vecstIntersection.begin(), vecstIntersection.end());
        set<SQWORD> setsqCurCrossing;
        SQWORD sqCnt = 0;
        for (SDWORD lCircle = 0; lCircle < 2; lCircle++) {
            for (auto intsect: vecstIntersection) {
                SQWORD sqCircleIdx = intsect.sqCircleIdx;
                if (PNT_EVENT_ADD == intsect.eEv) {
                    /* 追加 */
                    setsqCurCrossing.insert(sqCircleIdx);
                } else {
                    /* 削除 */
                    setsqCurCrossing.erase(sqCircleIdx);
                }
                sqCnt = max((SQWORD)setsqCurCrossing.size(), sqCnt);
            }
        }
        sqMaxIntersect = max(sqMaxIntersect, sqCnt);
    }
    cout << (sqMaxIntersect + 1) << endl;
}


int main(void)
{
    vector<VECTOR_2D> vecCenter;

    while(1) {
        PROBLEM_ONE stPro;
        cin >> stPro.sqN;
        if (0 == stPro.sqN) {
            break;
        }

        stPro.vecCenter.clear();
        for (SQWORD sqIdx = 0; sqIdx < stPro.sqN; sqIdx++) {
            DOUBLE dCenterX, dCenterY;
            cin >> dCenterX >> dCenterY;

            stPro.vecCenter.push_back(VECTOR_2D{dCenterX, dCenterY});
        }
        solve(stPro);
    }

    return 0;
}