#include <iostream>
#include <vector>
#include<cmath>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back

double solve(pair<double,double> a ,pair<double,double> b){
    double x=(a.first-b.first);
    x=x*x;
    double y=(a.second-b.second);
    y=y*y;
    return sqrt(x+y);
    
}

int main(){
    double eps=0.000000001;
    char ch;
    int n;
    while(cin>>n){
        if(n==0)break;
        pair<double,double> data[100];
        rep(i,n){
            cin>>data[i].first>>ch>>data[i].second;
        }
        int maxi=0;
        rep(i,n){
            int c=0;
            rep(j,n){
                if(solve(data[i],data[j])<=2+eps)c++;
            }
            maxi=max(maxi,c);
        }
        cout<<maxi<<endl;
    }
}