#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#include <complex>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define EPS 1e-9

using namespace std;
typedef complex<double> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.overlaps_of_seals", "r", stdin );
	int n;
	while (scanf ("%d", &n ), n ){
		vector<P> p(n );
		rep (i, n ){
			double x, y;
			scanf ("%lf,%lf", &x, &y );
			p[i].real() = x;
			p[i].imag() = y;
		} // end rep

		vector<P> ip; ip.clear();		
		rep (i, n ){
			for (int j = i+1; j < n; j++ ){
				P d = p[j] - p[i];
				if (abs(abs (d) - 2. ) < EPS ){
					ip.push_back ((p[i]+p[j])/2.0 );
				}else
				if (abs (d) < 2. ){
					double t = acos (abs(d)/2.0 );
					ip.push_back (p[i]+polar(1.0, arg(d)+t ) );
					ip.push_back (p[i]+polar(1.0, arg(d)-t ) );
				} // end if
			} // end for									
		} // end rep

		int res = 1;
		rep (i, ip.size() ){
			int curr = 0;
			rep (j, n ){
				if (abs (ip[i] - p[j] ) < 1. + EPS ){
		 			curr++;
				} // end if
			} // end rep
			res = max (res, curr );
		} // end rep
		cout << res << endl;

	} // end loop
		
	return 0;
}