#include <iostream>
#include <cassert>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <complex>
#include <cmath>

using namespace std;
typedef long long ll;

typedef long double R;
typedef complex<R> P;

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

const R EPS = 1e-10;
const R PI = acos((R)(-1));

/*
 -1 -> neg
  0 -> near 0
  1 -> pos
  */
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}

int sgn(R a, R b) {
    return sgn(b-a);
}

bool near(P a, P b) {
    return !sgn(abs(a-b));
}

R cross(P a, P b) { return imag(conj(a)*b); }
R dot(P a, P b) { return real(conj(a)*b); }


R ssqrt(R d) {
    d = max<R>(0, d);
    return sqrt(d);
}

R sacos(R d) {
    d = max<R>(-1, d);
    d = min<R>(1, d);
    return acos(d);
}

struct L {
    P x, y;
    L() {};
    L(P x, P y) :x(x), y(y) {};
};

struct C {
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

//return number of cross point
int crossP(const C &c, const C &d, L &l) {
    if (near(c.p, d.p) && !sgn(c.r, d.r)) return -1;
    R di = abs(c.p - d.p);
    if (sgn(c.r+d.r, di) == 1) return 0;
    if (sgn(di, abs(c.r-d.r)) == 1) return 0;
    R bth = arg(d.p - c.p);
    R th = sacos((c.r*c.r + di*di - d.r*d.r) / (2*c.r*di));
    l.x = c.p+polar<R>(c.r, bth+th);
    l.y = c.p+polar<R>(c.r, bth-th);
    if (sgn(th) == 0) return 1;
    return 2;
}

const int MN = 110;
int n;
C c[MN];
vector<P> v;

int main() {
    while (true) {
        v.clear();
        cin >> n;
        if (!n) break;
        for (int i = 0; i < n; i++) {
            R x, y; char ign;
            cin >> x >> ign >> y;
            c[i] = C(P(x, y), 1.0);
            v.push_back(P(x, y));
        }
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                L l;
                int u = crossP(c[i], c[j], l);
                if (u > 0) {
                    v.push_back(l.x);
                    v.push_back(l.y);
                }
            }
        }
        int res = -1;
        for (P p: v) {
            int r = 0;
            for (int i = 0; i < n; i++) {
                if (sgn(abs(p-c[i].p), 1.0) >= 0) r++;
            }
            res = max(res, r);
        }
        cout << res << endl;
    }
    return 0;
}