#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

typedef pair<double, double> Point;

double d2( Point p1, Point p2 ) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return dx * dx + dy * dy;
}

Point sub( Point p1, Point p2 ) {
  return Point( p1.first - p2.first, p1.second - p2.second );
}

Point add( Point p1, Point p2 ) {
  return Point( p1.first + p2.first, p1.second + p2.second );
}

Point div( Point p, double val ) {
  return Point( p.first / val, p.second / val );
}

Point middle( Point p1, Point p2 ) {
  return div( add( p1, p2 ), 2.0 );
}

double norm( Point p ) {
  return sqrt( p.first * p.first + p.second * p.second );
}

Point normalize( Point p ) {
  double n = norm( p ) * (1 + 1e-10);
  return div( p, n );
}

Point rotate( Point p, double th ) {
  double x = cos( th ) * p.first - sin( th ) * p.second;
  double y = sin( th ) * p.first + cos( th ) * p.second;
  return Point( x, y );
}								

void cross( Point p1, Point p2, Point &a1, Point &a2 ) {
  Point v = normalize( sub( p1, p2 ) );
  double th = acos( sqrt( d2( p1, p2 ) ) / 2.0 );
  a1 = add( rotate( v, th ), p2 );
  a2 = add( rotate( v, -th ), p2 );
}

void print( Point p ) {
  cerr << p.first << ", " << p.second << endl;
}

int main() {
  while( true ) {
	int n;
	scanf( "%d\n", &n );
	if ( n == 0 ) break;
	
	vector<Point> vs( n );
	for ( int i = 0; i < n; i++ ) {
	  double x, y;
	  scanf( "%lf,%lf", &x, &y );
	  vs[ i ] = make_pair( x, y );
	}
	vector<Point> cands;
	for ( int i = 0; i < n; i++ ) {
	  for ( int j = i + 1; j < n; j++ ) {
		double d = d2( vs[ i ], vs[ j ] );
		if ( d == 4 ) {
		  cands.push_back( middle( vs[ i ], vs[ j ] ) );
		} else if ( d < 4 ) {
		  Point p1, p2;
		  cross( vs[ i ], vs[ j ], p1, p2 );
		  cands.push_back( p1 );
		  cands.push_back( p2 );
  		}
	  }
	}
	int maxCount = 0;
	for ( Point p : cands ) {
	  int c = 0;
	  for ( Point v : vs ) {
		if ( d2( p, v ) <= 1.0 ) {
		  c++;
		}
	  }
	  maxCount = max( maxCount, c );
	}
	cout << maxCount << endl;
  }
}