#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

class Vector2
{
public:
	Vector2(){}
	Vector2( double _x, double _y ) : x( _x ), y( _y ){}
	~Vector2(){}

	double length2pow() const { return x*x + y*y; }

	double x, y;
};

const double RADIUS = 1.0;

int main(){
	int n;
	char c;

	while ( cin >> n && n ){
		vector< Vector2 > list;
		int maxCount = 1;
		for( int i = 0; i < n; ++i ){
			Vector2 v;
			cin >> v.x >> c >> v.y;
			list.push_back( v );
		}
		for( int i = 0; i < n - 1; ++i ){
			for( int j = i+1; j < n; ++j ){
				Vector2 distance( list[ j ].x - list[ i ].x, list[ j ].y - list[ i ].y );
				Vector2 pc1, pc2;
				double len = sqrt( distance.length2pow() );
				if( len > RADIUS * RADIUS * 2 ){
					continue;
				}else if( len == RADIUS * RADIUS * 2 ){
					pc1.x = pc2.x = list[ i ].x + distance.x / 2;
					pc1.y = pc2.y = list[ i ].y + distance.y / 2;
				}else{
					Vector2 m( distance.x / 2, distance.y / 2 );
					double mx = list[ i ].x + m.x;
					double my = list[ i ].y + m.y;
					double ml = m.length2pow();
					double side = RADIUS * RADIUS - ml;
					double rate = sqrt( side / ml );
					Vector2 tv( -m.y * rate, m.x * rate );
					pc1.x = mx + tv.x;
					pc1.y = my + tv.y;
					pc2.x = mx - tv.x;
					pc2.y = my - tv.y;

					int cnt1 = 2, cnt2 = 2;
					for( int k = 0; k < n; ++k ){
						if( k == i || k == j ){
							continue;
						}
						Vector2 td1( list[ k ].x - pc1.x, list[ k ].y - pc1.y );
						Vector2 td2( list[ k ].x - pc2.x, list[ k ].y - pc2.y );
						if( td1.length2pow() <= RADIUS * RADIUS ){
							++cnt1;
						}
						if( td2.length2pow() <= RADIUS * RADIUS ){
							++cnt2;
						}
					}
					maxCount = max( maxCount, max( cnt1, cnt2 ) );
				}
			}
		}

		cout << maxCount << endl;
	}

	return 0;
}