#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

const double eps = 1e-10;

bool solve(){
  int n;
  double x[100], y[100];
  vector<pair<double,double> > vec;
  
  scanf("%d",&n);
  
  if(n == 0) return false;
  
  for(int i=0;i<n;i++){
    scanf("%lf,%lf",x+i,y+i);
  }

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      double dx = x[j]-x[i];
      double dy = y[j]-y[i];

      if(dx*dx + dy*dy <= 4 + eps){
      
        double a = (dx*dx + dy*dy + 1 - 1)/2;
        
        double cx1 = (a*dx + dy * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cy1 = (a*dy - dx * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cx2 = (a*dx - dy * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cy2 = (a*dy + dx * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        
        vec.push_back({cx1+x[i],cy1+y[i]});
        vec.push_back({cx2+x[i],cy2+y[i]});
      }
    }
  }

  int ans = 1;
  
  for(int i=0;i<vec.size();i++){
    int counter = 0;
    
    for(int j=0;j<n;j++){
      double dx = x[j] - vec[i].first;
      double dy = y[j] - vec[i].second;

      if(dx*dx + dy*dy <= 1 + eps){
        counter ++;
      }
      
    }

    ans = max(ans, counter);
  }

  printf("%d\n",ans);
  
  return 0;
}

int main(){

  while(solve());
  
}