#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 ツ閉スツ姪環甘エツ可スツづ可つィツつッツづゥツベツクツトツδ仰可可算 http://www.deqnotes.net/acmicpc/2d_geometry/

typedef complex<double> P;
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)


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 ) );

		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

		int res = 0;
		for (int i = 0; i < n; ++i ){
			int sum = 1;
			for (int j = 0; j < n; ++j ){
				if (d[i][j] <= 2.0 ){
					++sum;
				} // end if
			} // end for
			res = max (res, sum );
		} // end for
		cout << res << endl;	

	} // end loop

		
	return 0;
}