#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

const double eps = 1e-6;
int n;
double X[101];
double Y[101];

double getDistance( double x1, double y1, double x2, double y2 ) {
    double x = x2 - x1;
    double y = y2 - y1;
    return sqrt( x * x + y * y );
}

bool equal( double a, double b ) {
    return fabs( a - b ) < eps;
}

struct Vector {
    double x;
    double y;
    Vector() {}
    Vector( double x, double y ): x(x), y(y) {}
    double getLength() {
        return ::getDistance( 0, 0, x, y );
    }
    Vector operator +( const Vector& v ) {
        return Vector( x + v.x, y + v.y );
    }
    Vector operator -( const Vector& v ) {
        return Vector( x - v.x, y - v.y );
    }
    void normalize( double r ) {
        double l = getLength();
        x = x * ( r / l );
        y = y * ( r / l );
    }
};

int solve() {
    int answer = 1;
    for ( int i = 0; i < n; ++ i ) {
        for ( int j = 0; j < n; ++ j ) {
            if ( i == j ) continue;
            Vector oi( X[i], Y[i] );
            Vector oj( X[j], Y[j] );
            Vector sub = oj - oi;
            double L = sub.getLength();
            if ( equal( L, 2.0 ) ) {
                sub.normalize( 1.0 );
                Vector p = sub + oi;
                int cnt = 2;
                for ( int k = 0; k < n; ++ k ) {
                    if ( k == i || k == j ) continue;
                    double d = getDistance( p.x, p.y, X[k], Y[k] );
                    if ( equal( d, 1.0 ) || d < 1.0 ) {
                        cnt++;
                    }
                }
                answer = max( answer, cnt );
            } else if ( L < 2.0 ) {
                double t = L * L / ( 2.0 * L );
                double a = acos( t );
                double a0 = atan2( sub.y, sub.x );
                Vector q1( oi.x + cos( a0 + a ), oi.y + sin( a0 + a ) );
                Vector q2( oi.x + cos( a0 - a ), oi.y + sin( a0 - a ) );
                int cnt1 = 2;
                int cnt2 = 2;
                for ( int k = 0; k < n; ++ k ) {
                    if ( k == i || k == j ) continue;
                    double d = getDistance( q1.x, q1.y, X[k], Y[k] );
                    if ( equal( d, 1.0 ) || d < 1.0 ) {
                        ++ cnt1;
                    }
                }
                for ( int k = 0; k < n; ++ k ) {
                    if ( k == i || k == j ) continue;
                    double d = getDistance( q2.x, q2.y, X[k], Y[k] );
                    if ( equal( d, 1.0 ) || d < 1.0 ) {
                        ++ cnt2;
                    }
                }
                answer = max( answer, max( cnt1, cnt2 ) );
            }
        }
    }
    return answer;
}

int main() {
    while ( cin >> n && n ) {
        for ( int i = 0; i < n; ++ i ) {
            string line;
            cin >> line;
            replace( line.begin(), line.end(), ',', ' ' );
            istringstream is( line );
            is >> X[i] >> Y[i];
        }
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 0