#include <iostream>
#include <vector>
#include <utility>
#include <functional>
#include <algorithm>
#include <cmath>
#include <cfloat>
using namespace std;
 
class circle{
private:
    double x,y;
public:
    circle(double x, double y){
        this->x=x;
        this->y=y;
    }
    double getDistance(circle other){
        double t_x = fabs(this->x - other.getX());
        double t_y = fabs(this->y - other.getY());
        return (t_x*t_x)+(t_y*t_y);
    }
    double getX(){
        return x;
    }  
    double getY(){
        return y;
    }
};
 
//0090
int main(){
    int n;
    double x, y;
    vector<circle> circle_set;
 
    while(cin >> n, n){
        for(int i=0; i<n; ++i){
            char ch;
            cin >> x >> ch >> y;
            circle_set.push_back(circle(x,y));
        }
        vector<int> count1;
        vector<circle>::iterator ite = circle_set.begin();
        for(; ite!=circle_set.end(); ++ite){
 
            vector<circle>::iterator ite2 = circle_set.begin();
            int count=0;
            for(; ite2!=circle_set.end(); ++ite2){
                if(ite==ite2){
                    continue;
                }
                circle other = *ite2;
                if((*ite).getDistance(other) <=4.0 ){
                    ++count;
                }
            }
            count1.push_back((count?count+1:0));
        }
        sort(count1.begin(), count1.end(), greater<int>());
        cout << count1[0] << endl;
		circle_set.clear();
		count1.clear();
    }
}