#include<iostream>
#include<math.h>
#include<vector>
using namespace std;

typedef pair<double,double>pd;
double EPS=1e-5;
double sq(double a){
    return a*a;
}
double dis(pd p1,pd p2){
    return sqrt(sq(p1.first-p2.first)+sq(p1.second-p2.second));
}
pd add(pd p1,pd p2){
    return make_pair(p1.first+p2.first, p1.second+p2.second);
}
pd minu(pd p1,pd p2){
    return make_pair(p1.first-p2.first, p1.second-p2.second);
}
double inter(pd p1,pd p2){
    return sqrt(sq(p1.first-p2.first)+sq(p1.second-p2.second));
}
int main(){
    double n;
    while(cin>>n,n){
        double x,y;
        int ans=1;
        char c;
        vector<pd>vec;
        for(int i=0;i<n;i++){
            cin>>x>>c>>y;
            vec.push_back(make_pair(x, y));
        }
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(dis(vec[i],vec[j])<=2){
                    double pm=sqrt(1-sq(dis(vec[i],vec[j])/2));
                    double lam=pm/dis(vec[i],vec[j]);
                    pd m=add(vec[i], vec[j]);
                    m.first/=2;
                    m.second/=2;
                    pd pt=make_pair(lam*(vec[i].second-vec[j].second),lam*(vec[j].first-vec[i].first));
                    pd p1=add(m,pt);
                    pd p2=minu(m,pt);
                    int cou=0;
                    if(p1.first>=0-EPS&&p1.second>=0-EPS&&p1.first<=10+EPS&&p1.second<=10+EPS)
                        for(int a=0;a<n;a++){
                            if(dis(vec[a],p1)<=1+EPS){cou++;}
                        }
                    if(ans<cou)ans=cou;
                    cou=0;
                    if(p2.first>=0-EPS&&p2.second>=0-EPS&&p2.first<=10+EPS&&p2.second<=10+EPS)
                        for(int a=0;a<n;a++){
                            if(dis(vec[a],p2)<=1+EPS)cou++;
                        }
                    if(ans<cou)ans=cou;
                }
            }
        }
        cout<<ans<<endl;
    }
}