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

typedef complex<double> P;
double const eps=1e-8;
P ps[128];
int n;

int solve(){
    int res=1;
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
        P &p1=ps[i], &p2=ps[j];
        double d=abs(p1-p2);
        if(d>2) continue;
        P h=(p1-p2)/d*P(0,1)*sqrt(1-d*d/4.);
        P m=(p1+p2)/2.;
        P q1=m+h, q2=m-h;
        // cout << i << " " << j << ":";
        for(int x=0;x<2;x++){
            int t=0;
            for(int k=0;k<n;k++){
                if(abs(q1-ps[k])<=1+eps){
                    t++;
                    // cout << k << " ";
                }
            }
            // cout << endl;
            res=max(res,t);
            swap(q1,q2);
        }
    }
    return res;
}

int main(){
    while(scanf("%d",&n)!=EOF && n){
        for(int i=0;i<n;i++){
            double x,y; scanf("%lf,%lf",&x,&y);
            ps[i] = P(x,y);
        }
        printf("%d\n",solve());
    }
}