#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];
    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]) );
      d[i][j] = d[j][i] = dist;
    }
    int ans = 1;
    set<int> gr;
    REP(i,n)FOR(j,i+1,n){
      if(d[i][j]<=2){
        gr.clear();
        gr.insert(i); gr.insert(j);
      }
      bool f = false;
      do{
        f = false;
        REP(k,n){
          if(gr.find(k)!=gr.end()) continue;
          set<int>::iterator it = gr.begin();
          bool f2 = true;
          for(;it!=gr.end(); it++){
            if(d[k][*it]>2){
              f2 = false;
              break;
            }
          }
          if(f2){
            f = true;
            gr.insert(k);
          }
        }
      }while(f);
      ans = max(ans,(int)gr.size());
    }
    cout<<ans<<endl;
  }
  return 0;
}