#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;

const int INF = INT_MAX / 4;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( ui i = (ui)( m ); i < (ui)( n ); i++ )
#define EACH( v, c ) for ( __typeof( c.front() ) &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

double powdist( double x1, double y1, double x2, double y2 )
{
	return pow( x1 - x2, 2 ) + pow( y1 - y2, 2 );
}

double dist( double x1, double y1, double x2, double y2 )
{
	return sqrt( pow( x1 - x2, 2 ) + pow( y1 - y2, 2 ) );
}

int main()
{
	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		vector<double> x( n ), y( n );
		char dummy;

		REP( i, 0, n )
		{
			cin >> x[i] >> dummy >> y[i];
		}

		int res = 1;

		REP( i, 0, n )
		{
			REP( j, i + 1, n )
			{
				if ( powdist( x[i], y[i], x[j], y[j] ) <= 4 )
				{
					double mx = ( x[i] + x[j] ) / 2, my = ( y[i] + y[j] ) / 2;
					double xl = sqrt( 1 - pow( dist( x[i], y[i], x[j], y[j] ) / 2, 2 ) );
					
					double ox1 = mx, oy1 = my, ox2 = mx, oy2 = my;

					if ( x[i] - x[j] == 0 )
					{
						oy1 += xl;
						oy2 -= xl;
					}
					else if ( y[i] - y[j] == 0 )
					{
						ox1 += xl;
						oy2 -= xl;
					}
					else
					{
						double s = -( ( x[j] - x[i] ) / ( y[j] - y[i] ) );
						double th = atan( s );
						
						ox1 = mx + xl * cos( th );
						oy1 = my + xl * sin( th );

						ox2 = mx - xl * cos( th );
						oy2 = my - xl * sin( th );
					}

					int tmp1 = 2, tmp2 = 2;

					REP( k, 0, n )
					{
						if ( i == k || j == k )
						{	
							continue;
						}

						if ( powdist( x[k], y[k], ox1, oy1 ) <= 1 )
						{
							tmp1++;
						}

						if ( powdist( x[k], y[k], ox2, oy2 ) <= 1 )
						{
							tmp2++;
						}
					}

					res = max( res, max( tmp1, tmp2 ) );
				}
			}
		}

		cout << res << endl;
	}

	return 0;
}