#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

template<typename T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<typename T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<typename T> inline bool semige(T x, T y){ return y - x < -EPS; }
template<typename T> inline bool semile(T x, T y){ return x - y < -EPS; }


struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // ??????
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // ??????
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i+1)%P.size()]


struct Circle : Point
{
private:
  Point p;
  double r;

public:
  Circle(Point& p, double r) : p(p), r(r) {}
  Circle(double x, double y, double r) : p(Point(x, y)), r(r) {}
  inline Point center(){ return this->p; }
  inline double radius(){ return this->r; }
};

vector<Point> intersectionCC(Circle& A, Circle& B)
{
  vector<Point> ret;
  Point p = (A.center() + B.center());
  double m = (A.radius() + B.radius()) / abs(B.center() - A.center());
  double n = (A.radius() - B.radius()) / abs(B.center() - A.center());
  Point d = B.center() - A.center();

  double s = m * n;
  double t = sqrt((m * m - 1.0) * (1.0 - n * n));

  ret.pb((p + Point(s, -t) * d) / 2.0);
  ret.pb((p + Point(s,  t) * d) / 2.0);

  return ret;
}

int n;
double x, y;
const double r = 1.0;
vector<Circle> C;
vector<Point> can;

int main()
{
  while((cin >> n) && n){
    int res = 0;
    C.clear();
    rep(i, n){
      scanf("%lf,%lf", &x, &y);
      C.pb(Circle(x, y, r));
    }

    rep(i, n) rrep(j, i+1, n) if(!semige(abs(C[i].center() - C[j].center()), 2 * r)){
      vector<Point> in = intersectionCC(C[i], C[j]);
      can.pb(in[0]);
      can.pb(in[1]);
    }

    vrep(v, can){
      int cnt = 0;
      vrep(w, C) if(!semige(abs(*v - w->center()), r)) cnt += 1;
      maxup(res, cnt);
    }

    cout << res << endl;
  }

  return 0;
}