#include "bits/stdc++.h"
using namespace std;

class Pt{
    public:
    double x, y;
    Pt(double x = 0, double y = 0):x(x),y(y){}
    Pt operator + (Pt p){return Pt(x + p.x, y + p.y);}
    Pt operator - (Pt p){return Pt(x - p.x, y - p.y);}
    Pt operator / (double d){return Pt(x / d, y / d);}
    Pt operator * (double d){return Pt(x * d, y * d);}
    Pt operator * (Pt p){return Pt(x * p.y, -y * p.x);}
    bool operator > (Pt p){return ((abs(x - p.x) > 1e-7) ? x > p.x: y > p.y);}
    double norm(){return hypot(x, y);}
    Pt rot90(){return Pt(-y, x);}
    Pt rot180(){return Pt(-x, -y);}
    Pt rot270(){return Pt(y, -x);}
    string str(){stringstream ss;ss<<x<<", "<<y;return ss.str();}
};

vector<Pt>cc_cross(Pt p1, double r1, Pt p2, double r2){
    double d = (p1 - p2).norm();
    if(r1 + r2 < d)return vector<Pt>(0);
    double rc = (d * d + r1 * r1 - r2 * r2) / (2 * d);
    double rs = sqrt(max(r1 * r1 - rc * rc, 0.0));
    Pt diff = (p2 - p1) / d;
    vector<Pt>points = {p1 + diff * rc + diff.rot90() * rs, p1 + diff * rc + diff.rot270() * rs};
    return points;
}

void AOJ_CGL7E(){
    Pt p1, p2;
    double r1, r2;
    cin >> p1.x >> p1.y >> r1;
    cin >> p2.x >> p2.y >> r2;
    vector<Pt>points = cc_cross(p1, r1, p2, r2);
    if(points[0] > points[1])swap(points[0], points[1]);
    printf("%.10f %.10f %.10f %.10f\n", points[0].x, points[0].y, points[1].x, points[1].y); 
}

void AOJ_0090(){
    for(int N; cin >> N,N;){
        vector<Pt>v(N);
        vector<Pt>c;
        for(int i = 0; i < N; i++){
            scanf("%lf,%lf", &v[i].x, &v[i].y);
            c.push_back(v[i]);
        }
        for(int i = 0; i < N; i++){
            for(int j = 0; j < i; j++){
                vector<Pt> points = cc_cross(v[i], 1, v[j], 1);
                if(points.size() == 0)continue;
                c.push_back(points[0]);
                c.push_back(points[1]);
            }
        }
        int ans = 0;
        for(auto p : c){
            int cnt = 0;
            for(auto q : v){
                if((p - q).norm() <= 1.0)cnt++;
            }
            if(ans < cnt)ans = cnt;
        }
        cout << ans << endl;
    }
}

int main(){
    
    AOJ_0090();

    return 0;
}
