#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>

using namespace std;

typedef pair<double, double> P;
#define X first
#define Y second
#define MAX_N 100

int par[MAX_N];	// e
int rank[MAX_N];	// ØÌ[³

// nvfÅú»
void init (int n )
{
	for (int i = 0; i < n; ++i ){
		par[i] = i;
		rank[i] = 0;
	} // end for
}

// ØÌªðßé
int find (int x )
{
		// ©ª©gªªÌê
		if (par[x] == x ){
			return x;
		} // end if

		// ªÉü©ÁÄké
		return par[x] = find(par[x] );
}

// xÆyÌ®·éWð¹
void unite (int x, int y )
{
	x = find (x);
	y = find (y);

	// ªª¯¶Èç½àµÈ¢
	if (x == y ){
		return;
	} // end if

	// Nª¬³¢ûÌØðÔçº°é
	if (rank[x] < rank[y] ){
			par[x] = y;
	}else if (rank[x] > rank[y] ){
			par[y] = x;
	}else{	// if (rank[x] == rank[y] )
			par[y] = x;
			rank[x]++;
	} // end if
}

// xÆyª¯¶WÉ®·é©Û©
bool same (int x, int y )
{
	return find(x) == find(y);
}

int main()
{
//	cut here before submit 
//	freopen("testcase.os", "r", stdin);
	int n;

	while (cin >> n && n ){	

		vector <vector <double> > d2 (n, vector <double> (n, 500.0 ) );

		// union-findØÌú»
		init (n);
		P p[n];
		for (int i = 0; i < n; ++i ){
			string str;
			cin >> str;
			str = str.replace(str.find(','), 1, " " );
			stringstream ss (str );
			ss >> p[i].X >> p[i].Y;
		} // end for
	
		for (int i = 0; i < n; ++i ){
			for (int j = 0; j < n; ++j ){
				if (i != j ){
					d2[i][j] = fabs( (p[i].X - p[j].X)*(p[i].X - p[j].X)  + (p[i].Y - p[j].Y)*(p[i].Y - p[j].Y) );
				} // end if
			} // end for
		} // end for

		for (int i = 0; i < n; ++i ){
			for (int j = 0; j < n; ++j ){
				if (i != j && d2[i][j] <= 4.0 ){
					// i Æ j ð¹
					unite(i, j);
				} // end if
			} // end for
		} // end for

		int res = 0;
		for (int i = 0; i < n; ++i ){
			int sum = 1;
			for (int j = 0; j < n; ++j ){
				if (i != j && same (i, j) ){
						++sum;
				} // end if
			} // end for
			res = max (res, sum );
		} // end for
		cout << res << endl;	

	} // end loop

	return 0;
}