from math import sqrt

from bisect import bisect_left

def circle_center(x1, y1, x2, y2):

    xd = x2 - x1; yd = y2 - y1

    d = xd**2 + yd**2

    k = sqrt((4.0 - d) / d) / 2.0

    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0

    xd *= k; yd *= k

    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]

while 1:

    n = int(input())

    if n==0: break

    p = sorted(list(map(float, input().split())) for i in range(n))

    px = [e[0] for e in p]; py = [e[1] for e in p]

    prev = 0

    ans = 1

    for i in range(n):

        bx = px[i]; by = py[i]

        while bx - px[prev] >= 2.0: prev += 1

        for j in range(i+1, n):

            cx = px[j]; cy = py[j]

            if cx - bx >= 2.0: break

            if (bx - cx)**2 + (by - cy)**2 <= 4.0:

                for ex, ey in circle_center(bx, by, cx, cy):

                    count = 2

                    for k in range(prev, n):

                        if k==i or k==j: continue

                        dx = px[k]; dy = py[k]

                        if dx - ex >= 1.0: break

                        if (ex - dx)**2 + (ey - dy)**2 <= 1.0:

                            count += 1

                    ans = max(ans, count)

    print(ans)
from math import sqrt

def circle_center(x1, y1, x2, y2):

    xd = x2 - x1; yd = y2 - y1

    d = xd**2 + yd**2

    k = sqrt((4.0 - d) / d) / 2.0

    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0

    xd *= k; yd *= k

    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]

while 1:

    n = int(input())

    if n==0: break

    p = sorted(list(map(float, input().split())) for i in range(n))

    prev = 0

    ans = 1

    for i in range(n):

        bx, by = p[i]

        while bx - p[prev][0] >= 2.0: prev += 1

        for j in range(i+1, n):

            cx, cy = p[j]

            if cx - bx >= 2.0: break

            if abs(by - cy) <= 2.0 and (bx - cx)**2 + (by - cy)**2 <= 4.0:

                for ex, ey in circle_center(bx, by, cx, cy):

                    count = 2

                    for k in range(prev, n):

                        if k==i or k==j: continue

                        dx, dy = p[k]

                        if ex - dx >= 1.0: continue

                        if dx - ex >= 1.0: break

                        if abs(ey - dy) <= 1.0 and (ex - dx)**2 + (ey - dy)**2 <= 1.0:

                            count += 1

                    ans = max(ans, count)

    print(ans)
from math import sqrt
from bisect import bisect_left


def circle_center(x1, y1, x2, y2):
    xd = x2 - x1
    yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0
    yc = (y1 + y2) / 2.0
    xd *= k
    yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]


while 1:
    n = int(input())
    if n == 0:
        break
    p = sorted(list(map(float, input().split())) for i in range(n))
    px = [e[0] for e in p]
    py = [e[1] for e in p]
    prev = 0
    ans = 1
    for i in range(n):
        bx = px[i]
        by = py[i]
        while bx - px[prev] >= 2.0:
            prev += 1
        for j in range(i + 1, n):
            cx = px[j]
            cy = py[j]
            if cx - bx >= 2.0:
                break
            if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k == i or k == j:
                            continue
                        dx = px[k]
                        dy = py[k]
                        if dx - ex >= 1.0:
                            break
                        if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print(ans)

from math import sqrt


def circle_center(x1, y1, x2, y2):
    xd = x2 - x1
    yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0
    yc = (y1 + y2) / 2.0
    xd *= k
    yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]


while 1:
    n = int(input())
    if n == 0:
        break
    p = sorted(list(map(float, input().split())) for i in range(n))
    prev = 0
    ans = 1
    for i in range(n):
        bx, by = p[i]
        while bx - p[prev][0] >= 2.0:
            prev += 1
        for j in range(i + 1, n):
            cx, cy = p[j]
            if cx - bx >= 2.0:
                break
            if abs(by - cy) <= 2.0 and (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k == i or k == j:
                            continue
                        dx, dy = p[k]
                        if ex - dx >= 1.0:
                            continue
                        if dx - ex >= 1.0:
                            break
                        if (
                            abs(ey - dy) <= 1.0
                            and (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0
                        ):
                            count += 1
                    ans = max(ans, count)
    print(ans)

-from bisect import bisect_left -    px = [e[0] for e in p] -    py = [e[1] for e in p] -        bx = px[i] -        by = py[i] -        while bx - px[prev] >= 2.0: +        bx, by = p[i] +        while bx - p[prev][0] >= 2.0: -            cx = px[j] -            cy = py[j] +            cx, cy = p[j] -            if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0: +            if abs(by - cy) <= 2.0 and (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0: -                        dx = px[k] -                        dy = py[k] +                        dx, dy = p[k] +                        if ex - dx >= 1.0: +                            continue -                        if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0: +                        if ( +                            abs(ey - dy) <= 1.0 +                            and (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0 +                        ):