#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <complex>
using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef vector<vector<string> > vss;
typedef pair<int, int> pii;
#define INF 0x7fffffff
//#define INFLL 0x7fffffffffffffff
#define INFLL LLONG_MAX
#define SIZE(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()
#define FOR(i,x) for(int i=0;i<x;i++)
#define FORic(i,y,x) for(int i=y;i<=x;i++)
#define FORdc(i,y,x) for(int i=y;i>=x;i--)
#define FILL(a,v) memset(a, v, sizeof(a))
#define PI 3.14159265358979323846

typedef complex<long double> P; /* _ */
typedef pair<P, long double> C; /* ~ */
struct L { P p, q; L(P p, P q) : p(p), q(q) {} }; /* üª */

const long double EPS = 0;

// complexÉå¬ÖWªKvÈê
namespace std{
	bool operator < (const P &a, const P &b){ return make_pair(real(a),imag(a)) < make_pair(real(b),imag(b)); }
}

// ~Ìð·»è
bool crossCircle(C c1, C c2){
	long double r1 = c1.second;
	long double r2 = c2.second;
	long double d = abs(c1.first-c2.first);
	if(d<r1||d<r2)
		return d-abs(r1-r2)>=EPS;
	return r1+r2-d>=-EPS;
}

// ~Ìð_ðÔ·(æÉð·»èK{)
pair<P,P> crossPoint(C c1, C c2){
	long double r1 = c1.second;
	long double r2 = c2.second;
	long double r3 = abs(c1.first-c2.first);
	long double rc = (r3*r3+r1*r1-r2*r2)/(2*r3);
	long double rs = sqrt(r1*r1-rc*rc);
	P dif = (c2.first-c1.first)/r3;
	P p1 = c1.first+dif*P(rc,rs);
	P p2 = c1.first+dif*P(rc,-rs);
	return make_pair(p1,p2);
}

int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		vector<P> all;
		FOR(i,n){
			string temp;
			cin>>temp;
			long double x = atof(temp.substr(0,temp.find(',')).c_str());
			long double y = atof(temp.substr(temp.find(',')+1).c_str());
			//cout<<x<<endl;
			//cout<<y<<endl;
			all.push_back(P(x,y));
		}
		if(n==1){
			cout<<1<<endl;
			continue;
		}
		int N = SIZE(all);
		vector<P> ten;
		FOR(i, N-1){
			FORic(j, i+1, N-1){
				C c1 = make_pair(all[i], 1.0);
				C c2 = make_pair(all[j], 1.0);
				if(crossCircle(c1,c2)){
					pair<P,P> temp;
					temp = crossPoint(c1,c2);
					ten.push_back(temp.first);
					ten.push_back(temp.second);
				}
			}
		}
		int ans = 0;
		FOR(k, SIZE(ten)){
			int count = 0;
			FOR(i, N){
				if(abs(all[i]-ten[k])<=1.0){
					count++;
				}
			}
			ans = max(ans, count);
		}
		cout<<ans<<endl;
	}
	return 0;
}