#include <cstdio>
#include <cmath>
#include <complex>
#include <vector>

#define MAX 101
#define EPS 1e-9

typedef std::complex<double> P;
P p[MAX];

int n;

int main(){
    while(scanf("%d", &n)){
        if(n == 0) break;

        for(int i = 0; i < n; i++){
            double a, b;
            scanf("%lf,%lf", &a, &b);

            p[i].real(a);
            p[i].imag(b);
        }

        int max = 1;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                std::vector<P> v;
                if(std::abs(std::abs(p[j] - p[i]) - 2.0) < EPS){
                    P c = p[i] + p[j];
                    v.push_back(P(c.real() / 2.0, c.imag() / 2.0));
                }else if(std::abs(p[j] - p[i]) < 2.0){
                    P xx = p[j] - p[i];
                    P ce = p[i] + P(xx.real() / 2.0, xx.imag() / 2.0);
                    P no1 = (ce * P(0, +1)) / std::abs(xx);
                    P no2 = (ce * P(0, -1)) / std::abs(xx);
                    double dis = sqrt(1 - pow(std::abs(xx) / 2.0, 2));

                    v.push_back(ce + no1 * dis);
                    v.push_back(ce + no2 * dis);
                }

                if(v.empty()) continue;

                int cnt1 = 2, cnt2 = 2;
                for(int k = 0; k < n; k++){
                    if(k == i || k == j) continue;
                    if(std::abs(p[k] - v[0]) - 1.0 < EPS){ cnt1++; }
                    if(v.size() == 2 && std::abs(p[k] - v[1]) - 1.0 < EPS){ cnt2++; }
                }
                if(cnt1 < cnt2) cnt1 = cnt2;
                if(cnt1 > max) max = cnt1;
            }
        }
        printf("%d\n", max);
    }
    return 0;
}