#include<iostream>
#include<stdio.h>
#include<cmath>
#include<vector>

#define PI 3.141592654
#define RADIUS 1.0
#define DIAMETER 2*RADIUS
#define EPS 1e-10

struct POINT{
	double x;
	double y;

	POINT& operator += ( const POINT& p )
	{
		x += p.x;
		y += p.y;
		return *this;
	}
	POINT& operator -= ( const POINT& p )
	{
		x -= p.x;
		y -= p.y;
		return *this;
	}
	POINT& operator *= ( double factor )
	{
		x *= factor;
		y *= factor;
		return *this;
	}
	POINT& operator /= ( double factor )
	{
		x /= factor;
		y /= factor;
		return *this;
	}

	double Norm() const{ return sqrt( pow( x , 2 ) + pow( y , 2 ) ); }
};

POINT operator + ( const POINT& a , const POINT& b )
{
	POINT p(a);
	p += b;
	return p;
}

POINT operator - ( const POINT& a , const POINT& b )
{
	POINT p(a);
	p -= b;
	return p;
}

POINT operator * ( const POINT& a , double factor )
{
	POINT p(a);
	p *= factor;
	return p;
}

POINT operator / ( const POINT& a , double factor )
{
	POINT p(a);
	p /= factor;
	return p;
}

typedef POINT VECTOR;

std::istream& operator >> ( std::istream& s , POINT& p )
{
	char c;
	return s >> p.x >> c >> p.y;
}

double getDistance( const POINT& a , const POINT& b )
{
	return sqrt( pow( a.x - b.x , 2 ) + pow( a.y - b.y , 2 ) );
}

void getCrossPoint( const POINT& a , const POINT& b , POINT *p1 , POINT *p2 )
{
	POINT mid = ( a + b ) / 2;
	if( fabs(getDistance( a , b ) - DIAMETER) < EPS ){
		*p1 = mid;
		*p2 = mid;
		return;
	}
	else{
		VECTOR ab = b - a;
		double theta = atan( ab.y / ab.x );
		double h = sqrt( pow( RADIUS , 2 ) - pow( ab.Norm()/2 , 2) );
		p1->x = mid.x + h * cos( theta + PI/2 );
		p1->y = mid.y + h * sin( theta + PI/2 );
		p2->x = mid.x + h * cos( theta - PI/2 );
		p2->y = mid.y + h * sin( theta - PI/2 );
		return;
	}
}

int getMax( int a , int b )
{
	return a > b ? a : b;
}

int getOverlapMax( std::vector<POINT> o , int n )
{
	int overlap = 1;
	for( int i = 0 ; i < n-1 ; i++ ){
		for( int j = i+1 ; j < n ; j++ ){
			int cnt1 , cnt2;
			if( getDistance( o[i] , o[j] ) <= DIAMETER + EPS ){
				POINT p1, p2;
				getCrossPoint( o[i] , o[j] , &p1 , &p2 );
				cnt1 = 2;
				cnt2 = 2;
				for( int k = 0 ; k < n ; k++ ){
					if( k == i || k == j ){
						continue;
					}
					if( getDistance( o[k] , p1 ) <= RADIUS + EPS ){
						cnt1++;
					}
					if( getDistance( o[k] , p2 ) <= RADIUS + EPS ){
						cnt2++;
					}
				}
			}
			else{
				cnt1 = 0;
				cnt2 = 0;
			}
			if( overlap < getMax( cnt1 , cnt2 ) ){
				overlap = getMax( cnt1 , cnt2 );
			}
		}
	}

	return overlap;
}

int main(void)
{
	while(1){
		int n;
		std::cin >> n;
		if( n == 0 ){
			break;
		}
		std::vector<POINT> o;
		for( int i = 0 ; i < n ; i++ ){
			POINT p;
			std::cin >> p;
			o.push_back(p);
		}

		std::cout << getOverlapMax( o , n ) << std::endl;
	}

	return 0;
}