#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
//double EPS = 1e-7;

double EPS = 1e-10;



// ??????????????????????¶????????????????
double add(double a,double b){
	if(abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
	return a + b;
}

// ????¬?????????????????§???????
struct P {
	double x,y;
	P(){}
	P(double x,double y) : x(x), y(y){
	}
	P operator + (P p){
		return P(add(x, p.x), add(y, p.y));
	}
	P operator += (P p){
		x = add(x, p.x);
		y = add(y, p.y);
		return *this;
	}
	P operator - (P p){
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d){
		return P(x * d, y * d);
	}
	double dot(P p){	// ??????
		return add(x * p.x, y * p.y);
	}
	double det(P p){	// ??????
		return add(x * p.y, -y * p.x);
	}
	//???????¨??????????p???????§????????????¢ this*p
	P ccw(P p){
		double r_ = sqrt(add(p.x*p.x, p.y*p.y));
		//cout<<r_<<endl;
		return P(add(x*p.x, -y*p.y) / r_, add(x*p.y, y* p.x) / r_);
	}
	//this/p
	P cw(P p){
		double r_ = sqrt(add(p.x*p.x, p.y*p.y));
		//cout<<r_<<endl;
		return ccw(P(p.x/r_,-p.y/r_));
	}
	double dist2(P p){
		double dx = add(x , -p.x), dy = add(y , -p.y);
		//cout<<dx<<" "<<dy<<" "<<add(dx*dx, dy*dy)<<endl;
		return add(dx*dx, dy*dy);
	}
};

vector<P> p;
vector<P> cross;

void setCross(){
	for(int i = 0; i + 1 < p.size(); i++){
		for(int j = i + 1; j < p.size(); j++){
			if(p[i].dist2(p[j]) > 4.0 + EPS) continue;
			P dp = p[j] - p[i];
			//cout<<dp.x<<" "<<dp.y<<endl;
			P dp_cw = dp.cw(dp);
			double x = dp_cw.x/2.0;
			double y = sqrt(1 - x*x);
			//cout<<x<<" "<<y<<endl;
			if(x < EPS && y < EPS) continue;
			P tmp(x, y);
			tmp = tmp.ccw(dp);
			tmp += p[i];
			cross.pb(tmp);
			tmp = P(x, -y);
			tmp = tmp.ccw(dp);
			tmp += p[i];
			cross.pb(tmp);
		}
	}
}

bool check(P p1, P p2){
	return p1.dist2(p2) < 1.0 + EPS; 
}

int main(){
	int n;
	double x, y;
	char c;
	while(cin>>n && n){
		p.clear();
		cross.clear();
		rep(i, n){
			cin>>x>>c>>y;
			p.pb(P(x, y));
			//cout<<p.back().x<<" "<<p.back().y<<endl;
		}
		int ans = 0, tmp = 0;
		setCross();
		for(int i = 0; i < cross.size(); i++){
			tmp = 0;
			for(int j = 0; j < p.size(); j++){
				if(check(cross[i], p[j])){
					tmp++;
				}
			}
			ans = max(ans, tmp);
		}
		for(int i = 0; i < p.size(); i++){
			tmp = 0;
			for(int j = 0; j < p.size(); j++){
				if(check(p[i], p[j])){
					tmp++;
				}
			}
			ans = max(ans, tmp);
		}
		printf("%d\n", ans);
		// cout<<cross.size()<<endl;
		// for(int i = 0; i < cross.size(); i++){
		// 	cout<<cross[i].x<<" "<<cross[i].y<<endl;
		// }
	}
	// P point(0, 0), o(0, 1);
	// cout<<check(point, o)<<endl;
}