#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<sstream>
using namespace std;

#define EPS 1e-9

class Circle {
public:
    double x, y, r;
    Circle(double a, double b, double c) {x = a; y = b; r = c;}
//     bool touch(Circle c){return hypot(x-c.x, y-c.y) <= r+c.r;}
    bool touch(Circle c){return hypot(x-c.x, y-c.y) - (r+c.r) <= EPS ;}
};
int main()
{
    int n;
    while(cin>>n, n) {
        int answer = 0;
        vector<Circle> seal;
        for(int i=0; i<n; i++) {
            double x,y;
            scanf("%lf,%lf", &x, &y);
            seal.push_back(Circle(x, y, 1.0));
        }
        for(int i=0; i<n; i++) {
            int count = 0;
            for(int j=0; j<n; j++) {
                if(seal[i].touch(seal[j])) count++;
            }
            answer = max(answer, count);
        }
        cout<<answer<<endl;
        return 0;
    }
}