#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    double x[100],y[100];
    double d[100][100];
    vector< set<int> > overlap(n);
    REP(i,n)REP(j,n) d[i][j] = 100.0;
    REP(i,n){
      scanf("%lf,%lf",x+i,y+i);
    }
    REP(i,n)FOR(j,i+1,n){
      double dist = sqrt( (x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i]) );
      if(dist<=2){
        overlap[i].insert(j);
        overlap[j].insert(i);
      }
    }
    int ans = 0;
    REP(i,n){
      set<int> cor = overlap[i];
      set<int>::iterator it = cor.begin();
      while(it!=cor.end()){
        set<int>::iterator it2 = it;
        it2++;
        while(it2!=cor.end()){
          if(overlap[*it].find(*it2)==cor.end()){
            cor.erase(*it2);
          }
          it2++;
        }
        it++;
      }
      ans = max(ans,(int)cor.size()+1);
    }

    cout<<ans<<endl;
  }
  return 0;
}