#include <iostream>
#include <string>
#include <cmath>
#include <vector>
using namespace std;

double X[100], Y[100];

double sq(double x) {
    return x * x;
}

double sqsum(double a, double b) {
    return sq(a) + sq(b);
}

int main() {
    int n;
    while (cin >> n, n) {
        char c;
        for (int i=0; i<n; ++i) {
            cin >> X[i] >> c >> Y[i];
        }
        int ans = 1;
        for (int i=0; i<n; ++i) {
            for (int j=i+1; j<n; ++j) {
                if (sqsum(X[i] - X[j], Y[i] - Y[j]) > 4.0) continue;
                double cx = (X[i] + X[j]) / 2.0;
                double cy = (Y[i] + Y[j]) / 2.0;
                double w = hypot(X[i] - X[j], Y[i] - Y[j]);
                double h = sqrt(1.0 - sq(w / 2.0));
                double dx = (Y[i] - Y[j]) * h / w;
                double dy = (X[j] - X[i]) * h / w;
                int cnt1 = 2, cnt2 = 2;
                for (int k=0; k<n; ++k) {
                    if (k == i || k == j) continue;
                    if (sqsum(cx + dx - X[k], cy + dy - Y[k]) <= 1.0) cnt1 ++;
                    if (sqsum(cx - dx - X[k], cy - dy - Y[k]) <= 1.0) cnt2 ++;
                }
                ans = max(ans, max(cnt1, cnt2));
            }
        }
        cout << ans << endl;
    }
    return 0;
}