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

typedef pair<double, double> P;
constexpr double EPS = 1e-9;

vector<P> points;

// 2つの円の交点
void circle_intersection(double x1, double y1, double r1, double x2, double y2, double r2){
    x2 -= x1; y2 -= y1;
    if(x2*x2+y2*y2>(r1+r2)*(r1+r2)) return;
    double a = x2*x2+y2*y2, b = (a+r1*r1-r2*r2)/2;
    points.push_back(P((b*x2+y2*pow(a*r1*r1-b*b,0.5))/a+x1, (b*y2-x2*pow(a*r1*r1-b*b,0.5))/a+y1));
    points.push_back(P((b*x2-y2*pow(a*r1*r1-b*b,0.5))/a+x1, (b*y2+x2*pow(a*r1*r1-b*b,0.5))/a+y1));
}

// 点(px,py)と円(cx,xy,r)の内包判定
bool is_inside_circle(double px, double py, double cx, double cy, double r){
    return pow(px-cx,2)+pow(py-cy,2) < r*r + EPS;
}

int main() {
    int n;
    double x[100], y[100];
    while(cin >> n, n){
        points.clear();
        for(int i=0;i<n;i++){
            scanf("%lf,%lf",&x[i],&y[i]);
        }
        // 2つの円の交点を列挙
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                circle_intersection(x[i],y[i],1,x[j],y[j],1);
            }
        }
        int ans = 1;
        // 各点を内包する円の個数を数える
        for(auto &p : points){
            int cnt = 0;
            for(int i=0;i<n;i++){
                if(is_inside_circle(p.first,p.second,x[i],y[i],1)) cnt++;
            }
            ans = max(ans, cnt);
        }
        cout << ans << endl;
    }
    return 0;
}

