#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second


int dx[]={0,1,0,-1},dy[]={1,0,-1,0};

main(){
  int n;
  while(cin>>n,n){
    long double x[n],y[n];
    rep(i,n){
      cin>>x[i];
      cin.get();
      cin>>y[i];
    }
    int ans=1;
    rep(i,n-1){
      for(int j=i+1;j<n;j++){
        long double dx=x[j]-x[i],dy=y[j]-y[i];
        if(dx*dx+dy*dy>4)continue;
        int tans=0;
        long double xm=(x[j]+x[i])/2,ym=(y[j]+y[i])/2;
        long double arufa=atan2(dy,dx),beta=acos(sqrt((dx*dx+dy*dy))/2.0);
        long double kx=x[i]+cos(arufa+beta),ky=y[i]+sin(arufa+beta);
        rep(j,n){
          if(kx<0 || kx>10 || ky<0 || ky>10)continue;
          dx=kx-x[j],dy=ky-y[j];
          if(dx*dx+dy*dy<=1+EPS)++tans;
        }
        ans=max(ans,tans);
        tans=0;
        kx=x[i]+cos(arufa-beta),ky=y[i]+sin(arufa-beta);
        rep(j,n){
          if(kx<0 || kx>10 || ky<0 || ky>10)continue;
          dx=kx-x[j],dy=ky-y[j];
          if(dx*dx+dy*dy<=1+EPS)++tans;
        }
        ans=max(ans,tans);
      }
    }
    cout<<ans<<endl;
  }
}