#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0

struct _Point{
  double x,y;
} point[110];

int edge[110][110];
int memo[110];
bool used[110];

double sqr(double x){
  return x*x;
}
bool isoverlap(int i, int j){
  return sqr(point[i].x-point[j].x)+sqr(point[i].y-point[j].y)<=4.0;
}

int dfs(int node, int cnt){
  int ret = cnt;
  if( memo[node] ) return memo[node];
  used[node] = true;

  for(int i=node-1; i>=0; i--)if( !used[i] && edge[node][i]>0 ){
    ret = max(ret, dfs(i,cnt+1));
  }
  used[node] = false;
  return memo[node] = ret;
}

int main(){
  int n;
  
  while(scanf("%d",&n),n){
    rep(i,110)rep(j,110)edge[i][j]=0;
    rep(i,110)memo[i] = 0;

    rep(i,n){
      scanf("%lf,%lf",&point[i].x,&point[i].y);
      rep(j,i){
	if( isoverlap(i,j) ){
	  edge[i][j] = 1;
	}
      }
    }

#if DEB
    rep(i,n){
      rep(j,n){
	printf("%d ",edge[i][j]);
      }
      puts("");
    }
#endif

    int ans = 0;
    for(int i=n-1; i>=0; i--){
      ans = max(ans,dfs(i,1));
    }
    printf("%d\n",ans);

  }
  return 0;
}