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

#define SQ(x) ((x)*(x))

using namespace std;

const double EPS=1e-8;

int main(void){
  int n;
  while(cin>>n,n){
    vector<pair<double,double> > v;
    double a,b;
    for(int i=0;i<n;++i){
      scanf("%lf,%lf",&a,&b);
      v.push_back(make_pair(a,b));
    }
    int ans=0;
    for(int i=0;i<n;++i){
    	int tmp=0;
      for(int j=0;j<n;++j)
      	if(fabs(SQ(v[i].first-v[j].first)+SQ(v[i].second-v[j].second))-SQ(2.0)<EPS)++tmp;
      ans=max(ans,tmp);
    }
    cout<<ans<<endl;
  }
}