#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

double length(double x1, double y1, double x2, double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

bool intersection(double x1, double y1, double x2, double y2, double ret[2][2]){
    double l = length(x1,y1,x2,y2);
    if(l>2.0) return false;
    double theat = atan2(y2-y1, x2-x1);
    double alpha = acos(l/2.0);
    ret[0][0]=x1+cos(theat+alpha);
    ret[0][1]=y1+sin(theat+alpha);
    ret[1][0]=x1+cos(theat-alpha);
    ret[1][1]=y1+sin(theat-alpha);
    return  true;
}
int main(){
    int n;
    double seals[100][2];
    while (true){
        cin >> n;
        if (n == 0) break;
        for(int i = 0; i < n; i++){
            scanf("%lf,%lf", &seals[i][0], &seals[i][1]);
        }
        int max_seals=0;
        for(int i = 0; i < n - 1; i++){
            for(int j = i + 1; j < n; j++){
                double ret[2][2];
                if(intersection(seals[i][0], seals[i][1], seals[j][0], seals[j][1], ret)){
                    int counter = 0;
                    for(int k = 0; k < n; k++){
                        double l = length(ret[0][0], ret[0][1], seals[k][0], seals[k][1]);
                        if(l <= 1.000009)counter++;
                    }
                    max_seals = max(counter,max_seals);
                    counter = 0;
                    for(int k = 0; k < n; k++){
                        double l = length(ret[1][0], ret[1][1], seals[k][0], seals[k][1]);
                        if(l <= 1.000009)counter++;
                    }
                    max_seals = max(counter,max_seals);
                }
            }
        }
        if (max_seals == 0)
            cout<<1<<endl;
        else
            cout<<max_seals<<endl;
    }
}