#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
typedef complex<double> P;
typedef vector<P> VP;
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

VP crosspointCC(C a, C b){
    VP ret;
    double dist = abs(b.p-a.p);
    P dir = a.r*(b.p-a.p)/abs(b.p-a.p);
    if(EQ(dist, a.r+b.r) || EQ(dist, abs(a.r-b.r))){
        ret.push_back(a.p +dir);
    }else if(abs(a.r-b.r) < dist && dist < a.r+b.r){
        double cos = (a.r*a.r +dist*dist -b.r*b.r)/(2*a.r*dist);
        double sin = sqrt(1 -cos*cos);
        ret.push_back(a.p +dir*P(cos, sin));
        ret.push_back(a.p +dir*P(cos, -sin));
    }
    return ret;
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<C> c(n);
        for(int i=0; i<n; i++){
            double x,y;
            scanf("%lf,%lf", &x, &y);
            c[i] = C(P(x, y), 1);
        }

        VP cand;
        for(int i=0; i<n; i++){
            cand.push_back(c[i].p);
            for(int j=i+1; j<n; j++){
                VP cp = crosspointCC(c[i], c[j]);
                cand.insert(cand.end(), cp.begin(), cp.end());
            }
        }

        int ans = 0;
        for(int i=0; i<(int)cand.size(); i++){
            int sub = 0;
            for(int j=0; j<n; j++){
                if(abs(c[j].p -cand[i]) < 1+EPS) sub++;
            }
            ans = max(ans, sub);
        }
        cout << ans << endl;
    }
    return 0;
}

