#include "bits/stdc++.h"

using namespace std;

using ld = long double;
using Point = std::complex<ld>;

const ld eps = 1e-9, pi = acos(-1.0);

namespace std
{
bool operator<(const Point &lhs, const Point &rhs)
{
    if (lhs.real() < rhs.real() - eps)
        return true;
    if (lhs.real() > rhs.real() + eps)
        return false;
    return lhs.imag() < rhs.imag();
}
} // namespace std

Point input_point()
{
    string s;
    cin >> s;
    int index = -1;
    int n = s.size();
    for (int i = 0; i < n; i++)
    {
        if (s[i] == ',')
        {
            index = i;
            break;
        }
    }
    assert(index != -1);
    string x = s.substr(0, index);
    string y = s.substr(index + 1);
    return Point(stold(x), stold(y));
}

bool eq(ld a, ld b)
{
    return (abs(a - b) < eps);
}

ld dot(Point a, Point b)
{
    return real(conj(a) * b);
}

ld cross(Point a, Point b)
{
    return imag(conj(a) * b);
}

// CCW::counter clockwise
int ccw(Point a, Point b, Point c)
{
    b -= a;
    c -= a;
    if (cross(b, c) > eps)
        return 1; // a,b,c : counter-clockwise
    if (cross(b, c) < -eps)
        return -1; // a,b,c : clockwise
    if (dot(b, c) < 0)
        return 2; // c,a,b : on a line
    if (norm(b) < norm(c))
        return -2; // a,b,c : on a line
    return 0;      // a,c,b : on a line
}

class Circle
{
public:
    Point p;
    ld r;
    Circle() : p(Point(0, 0)), r(0) {}
    Circle(Point p, ld r) : p(p), r(r) {}
};

// c1, c2 の交点
std::vector<Point> is_cc(Circle c1, Circle c2)
{
    std::vector<Point> res;
    ld d = abs(c1.p - c2.p);
    ld rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
    ld dfr = c1.r * c1.r - rc * rc;
    if (abs(dfr) < eps)
        dfr = 0.0;
    else if (dfr < 0.0)
        return res; // no intersection
    ld rs = sqrt(dfr);
    Point diff = (c2.p - c1.p) / d;
    res.emplace_back(c1.p + diff * Point(rc, rs));
    if (dfr != 0.0)
        res.emplace_back(c1.p + diff * Point(rc, -rs));
    return res;
}

int main()
{
    int n;
    while (cin >> n, n)
    {
        vector<Circle> cs;
        for (int i = 0; i < n; i++)
        {
            auto p = input_point();
            cs.emplace_back(p, 1.0);
        }
        vector<Point> ps;
        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                auto pp = is_cc(cs[i], cs[j]);
                for (const auto &p : pp)
                {
                    ps.emplace_back(p);
                }
            }
        }
        int ret = 1;
        for (const auto &p : ps)
        {
            int tmp = 0;
            for (int i = 0; i < n; i++)
            {
                if (abs(cs[i].p - p) < 1.0 + eps)
                {
                    tmp++;
                }
            }
            ret = max(ret, tmp);
        }
        cout << ret << endl;
    }
}

