#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>
#include <complex>

using namespace std;

// deq notes ½Êô½É¨¯éxNgZ http://www.deqnotes.net/acmicpc/2d_geometry/

typedef complex<double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

const int 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> > d (n, vector <double> (n, 10.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].real() >> p[i].imag();
		} // end for
	
		for (int i = 0; i < n; ++i ){
			for (int j = 0; j < n; ++j ){
				if (i != j ){
					d[i][j] = abs(p[i] - p[j]);
				} // end if
			} // end for
		} // end for

		for (int i = 0; i < n; ++i ){
			for (int j = 0; j < n; ++j ){
				if (d[i][j] <= 2.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;
}