#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-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int n;
int main(void){
  while(cin>>n){
    if(n==0) break;
    double x[100],y[100];
    REP(i,n){
      scanf("%lf,%lf",x+i,y+i);
    }
    int ans = 1;
    for(int i=0; i<n; i++){
      for(int j=i+1; j<n; j++){
        double dist = sqrt( (x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i]));
        if(dist>2) continue; 
        double thete = atan2(y[j]-y[i],x[j]-x[i]);
        double alpha = acos( (dist*dist)/(2*dist));
        double kx[2],ky[2];
        kx[0] = x[i] + cos(thete+alpha);
        ky[0] = y[i] + sin(thete+alpha);
        kx[1] = x[i] + cos(thete-alpha);
        ky[1] = y[i] + sin(thete-alpha);
        int tmp = 2;
        REP(k,n){
          if(i==k||j==k) continue;
          double d = sqrt((x[k]-kx[0])*(x[k]-kx[0]) + (y[k]-ky[0])*(y[k]-ky[0]));
          if(d<1+EPS) tmp++;
        }
        ans = max(tmp,ans);
        tmp = 2;
        REP(k,n){
          if(i==k||j==k) continue;
          double d = sqrt((x[k]-kx[1])*(x[k]-kx[1]) + (y[k]-ky[1])*(y[k]-ky[1]));
          if(d<1+EPS) tmp++;
        }
        ans = max(tmp,ans);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}