#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<double,double> P;

void init(int n,int* par,int* rank){
	for(int i=0;i<n;i++){
		par[i] = i;
		rank[i] = 0;
	}
}

int find(int x,int* par,int* rank){
	if(par[x] == x){
		return x;
	} else {
		return par[x] = find(par[x],par,rank);
	}
}

void unite(int x,int y,int* par,int* rank){
	x = find(x,par,rank);
	y = find(y,par,rank);
	if(x == y) return;

	if(rank[x] < rank[y]){
		par[x] = y;
	} else {
		par[y] = x;
		if(rank[x] == rank[y]) rank[x]++;
	}
}

bool same(int x,int y,int* par,int* rank){
	return find(x,par,rank) == find(y,par,rank);
}



int main(){
	double eps = 10e-7;
	double x,y;
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;

		vector<P> base;
		int res=0;
		for(int i=0;i<n;i++){
			scanf("%lf,%lf",&x,&y);
			base.push_back(P(x,y));
		}

		int* par = new int[n];
		int* rank = new int[n];
		init(n,par,rank);

		for(int i=0;i<base.size();i++){
			for(int j=0;j<base.size();j++){
				if(i==j) continue;
				double dist = sqrt(pow((base[i].first-base[j].first),2.0)+pow((base[i].second-base[j].second),2.0));

				if(dist <= 2.0){
					if(!same(i,j,par,rank)){
						unite(i,j,par,rank);
					}						
				}
			}
		}

		map<int,int> freq;
		for(int i=0;i<base.size();i++){
			freq[find(i,par,rank)]++;
		}

		for(map<int,int>::iterator it = freq.begin(); it != freq.end(); it++){
			res = max(res,it->second);
		}
		cout << res << endl;
	}
}