#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
struct Pt {
double x, y;
Pt() {}
	Pt(double x, double y) : x(x), y(y) {}
	Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
	Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
	Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
	Pt operator-() const { return Pt(-x, -y); }
	Pt operator*(const double &k) const { return Pt(x * k, y * k); }
	Pt operator/(const double &k) const { return Pt(x / k, y / k); }
	double abs() const { return sqrt(x * x + y * y); }
	double abs2() const { return x * x + y * y; }
	double arg() const { return atan2(y, x); }
	double dot(const Pt &a) const { return x * a.x + y * a.y; }
	double det(const Pt &a) const { return x * a.y - y * a.x; }
	bool operator<(const Pt &a) const { return (x != a.x) ? (x < a.x) : (y < a.y); }
	bool operator==(const Pt &a) const { return (sig(x - a.x) == 0 && sig(y - a.y) == 0); }
};
ostream &operator<<(ostream &os, const Pt &a) { os << "(" << a.x << ", " << a.y << ")"; return os; }
double tri(Pt a, Pt b, Pt c) { return (b - a).det(c - a); }


pair<Pt,Pt> pCC(Pt a, double r, Pt b, double s) {
	double d = (b - a).abs();
	double x = (d * d + r * r - s * s) / (d * 2);
	Pt e = (b - a) / d, w = e * Pt(0, 1) * sqrt(max(r * r - x * x, 0.0));
	return mp(a + e * x - w, a + e * x + w);
}

int main() {
	int n;
	vector<Pt> vp;
	while(n=in()){
		vp.clear();
		int i;
		Pt p;
		for(i=0;i<n;i++){
			scanf("%lf,%lf",&p.x,&p.y);
			vp.push_back(p);
		}
		int j;
		pair<Pt,Pt> pp;
		Pt pt;
		int max=1;
		for(i=0;i<n;i++){
			for(j=i+1;j<n;j++){
				if((vp[i]-vp[j]).abs()>2)continue;
				pp=pCC(vp[i],1,vp[j],1);
				pt=pp.first;
				if(-EPS<=pt.x&&pt.x<=10+EPS&&-EPS<=pt.y&&pt.y<=10+EPS){
					int k,s=0;
					for(k=0;k<n;k++){
						if((pt-vp[k]).abs()<=1+EPS){
							s++;
						}
					}
//cout<<"i "<<i<<endl;
//cout<<"j "<<j<<endl;
//cout<<pt<<endl;
//cout<<s<<endl;
					chmax(max,s);
				}
				pt=pp.second;
				if(-EPS<=pt.x&&pt.x<=10+EPS&&-EPS<=pt.y&&pt.y<=10+EPS){
					int k,s=0;
					for(k=0;k<n;k++){
						if((pt-vp[k]).abs()<=1+EPS){
							s++;
						}
					}
//cout<<"i "<<i<<endl;
//cout<<"j "<<j<<endl;
//cout<<pt<<endl;
//cout<<s<<endl;
					chmax(max,s);
				}
			}
		}
		cout<<max<<endl;
	}
	return 0;
}