#include<stdio.h>
#include<math.h>

#define OL(a,b) (sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))<=2)

typedef struct{
  double x;
  double y;
}Point;

int n;
int unko[100];
Point ps[100];

int solve(){
  int i,max=1,ans;
  for(i=0;i<n-1;i++){
      unko[0]=i;
      ans=anal(1);
      if(ans>max) max=ans;
  }
  return max;
}

int anal(int i){
  int c,d,max,ans;
  max=0;
  for(c=unko[i-1]+1;c<n;c++){
    for(d=0;d<i;d++){
      if(!OL(ps[unko[d]],ps[c])) break;
    }
    if(d==i){
      unko[i]=c;
      ans=anal(i+1);
      if(ans>max){
	max=ans;
      }
    }
  }
  return max+1;
}
int main(){
  int i;

  do{
    scanf("%d",&n);
    if(n==0) break;
    for(i=0;i<n;i++) scanf("%lf,%lf",&(ps[i].x),&(ps[i].y));
    printf("%d\n",solve());

  }while(1);
  return 0;
}
      