#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long double ld;

struct Point {
    ld x, y;
    Point(ld x=0, ld y=0) : x(x), y(y) {}
};

struct Circle {
    ld x, y, r;
    const static ld eps = 1e-9;
    Circle(ld x=0, ld y=0, ld r=0) : x(x), y(y), r(r) {}
    const bool isIntersect(const Circle& o) const {
        ld dx = x - o.x;
        ld dy = y - o.y;
        return (r + o.r) * (r + o.r) + eps >= dx*dx + dy*dy;
    }
    const pair<Point, Point> intersectionPoint(const Circle& o) const {
        ld dx = o.x - x;
        ld dy = o.y - y;
        ld a = (dx*dx + dy*dy + r*r - o.r*o.r) / 2.0;
        ld d = dx*dx+dy*dy;
        ld s = sqrt(d*r*r - a*a);
        Point p, q;
        p.x = (a * dx + dy * s) / d + x;
        q.x = (a * dx - dy * s) / d + x;
        p.y = (a * dy - dx * s) / d + y;
        q.y = (a * dy + dx * s) / d + y;
        return make_pair(p, q);
    }
    bool contains(const Circle& p) const {
        ld dx = x - p.x;
        ld dy = y - p.y;
        return r*r + eps >= dx*dx + dy*dy;
    }
};

int F(const Circle& o, const vector<Circle>& cs) {
    int cnt = 0;
    for (int i = 0; i < cs.size(); i++) 
        if (o.contains(cs[i]))
            cnt++;
    return cnt;
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<Circle> cs;
        for (int i = 0; i < n; i++) {
            ld x, y; 
            char d; // dummy
            cin >> x >> d >> y;
            cs.push_back(Circle(x, y, 1));
        }

        vector<Point> ips;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) continue;
                if (cs[i].isIntersect(cs[j])) {
                    pair<Point, Point> ip = cs[i].intersectionPoint(cs[j]);
                    ips.push_back(ip.first);
                    ips.push_back(ip.second);
                }
            }
        }

        if (ips.empty()) {
            cout << 1 << endl;
            continue;
        }

        int m = 0;
        for (int i = 0; i < ips.size(); i++) {
            //cout << "point: " << ips[i].x << ' ' << ips[i].y << endl;
            m = max(m, F(Circle(ips[i].x, ips[i].y, 1), cs));
        }
        cout << m << endl;
    }
    return 0;
}