#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<double,double> P;

int main(){
  int N;

  while(scanf("%d",&N) && N){
    vector<P> vec;
    double x,y;
    for(int i = 0 ; i < N ; i++){
      scanf("%lf,%lf",&x,&y);
      vec.push_back(P(x,y));
    }

    int max = 0;
    for(int i = 0 ; i < N ; i++){
      int cnt = 0;
      P a = vec[i];
      for(int j = 0 ; j < N ; j++){
	if(i == j) continue;
	P b = vec[j];
	x = (a.first-b.first)*(a.first-b.first);
      	y = (a.second-b.second)*(a.second-b.second);
	if(x+y <= 4) cnt++;
      }
      max = std::max(max,cnt+1);
    }
    printf("%d\n",max);
  }

  return 0;
}