#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
struct Point { long double px, py; };
struct Circle { Point p; long double r; };
Point pol(long double r, long double d) { return Point{ cosl(d) * r, sinl(d) * r }; }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
inline Point Minus(Point a, Point b) { return Point{ a.px - b.px,a.py - b.py }; }
inline Point Plus(Point a, Point b) { return Point{ a.px + b.px,a.py + b.py }; }
long double dst(const Point& a, const Point& b) { return abs(Minus(b, a)); }
pair<Point, Point> crp(Circle c1, Circle c2) {
    double d = abs(Minus(c1.p, c2.p));
    double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    double t = arg(Minus(c2.p, c1.p));
    return make_pair(Plus(c1.p, pol(c1.r, t + a)), Plus(c1.p, pol(c1.r, t - a)));
}
int main() {
    Circle x[100]; int n;
    while (true) {
        cin >> n; char ch; if (n == 0)break;
        for (int i = 0; i < n; i++) { cin >> x[i].p.px >> ch >> x[i].p.py; x[i].r = 1.0l; }
        int ret = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
            	vector<Point> z = crp(x[i], x[j]);
            	for(int k = 0; k < 2; k++) {
            		int cnt = 0;
            		for(int l = 0; l < n; l++) {
            			if(dst(z[k], x[l].p) <= 1.0L) cnt++;
            		}
            		ret = max(ret, cnt);
            	}
            }
        }
        cout << ret << endl;
    }
    return 0;
}