#include <iostream>
#include <vector>
#include <complex>
#include <algorithm>

using namespace std;

const double EPS = 1e-8;
typedef complex<double> P;

namespace std {
    bool operator < (const P& a, const P& b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}

struct C {
    P p; double r;
    C() {}
    C(const P &p, double r) : p(p), r(r) { }
};

bool IsLapCircle(const C &a, const C &b)
{
    double x = (a.p.real() - b.p.real());
    double y = (a.p.imag() - b.p.imag());
    double d = x * x + y * y;
    double rd = (a.r + b.r) * (a.r + b.r);

    if (d + EPS < rd)
        return true;
    else
        return false;
}

int main()
{
    int n;
    char ch;

    while (cin >> n, n) {
        vector<C> c(n);

        for (int i = 0; i < n; i++) {
            cin >> c[i].p.real() >> ch >> c[i].p.imag();
            c[i].r = 1.0;
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            int lap_num = 1;
            for (int j = 0; j < n; j++) {
                if (i == j)
                    continue;
                if (IsLapCircle(c[i], c[j]))
                    lap_num++;
            }
            ans = max(ans, lap_num);
        }
        cout << ans << endl;
    }
    return 0;
}