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

struct Point {
  double x, y;
  Point(){};
  Point(double x, double y) : x(x), y(y){};
  Point operator+(const Point &q) {
    Point t;
    t.x = x + q.x;
    t.y = y + q.y;
    return t;
  }
  Point operator+=(const Point &q) {
    x += q.x;
    y += q.y;
    return *this;
  }
  Point operator-(const Point &q) {
    Point t;
    t.x = x - q.x;
    t.y = y - q.y;
    return t;
  }
  Point operator-=(const Point &q) {
    x -= q.x;
    y -= q.y;
    return *this;
  }
  template <typename T> Point operator*(T d) {
    return Point(x * d, y * d);
  }
  template <typename T> Point operator*=(T d) {
    x *= d;
    y *= d;
    return *this;
  }
  template <typename T> Point operator/(T d) {
    return Point(x / d, y / d);
  }
  template <typename T> Point operator/=(T d) {
    x /= d;
    y /= d;
    return *this;
  }
  bool operator<(const Point &q) {
    return (x != q.x) ? (x < q.x) : (y < q.y);
  }
  bool operator>(const Point &q) {
    return (x != q.x) ? (x > q.x) : (y > q.y);
  }
  double norm(void) {
    return sqrt(x * x + y * y);
  }
  double arg(void) {
    return acos(x / this->norm()) * Point(1, 0).sign(*this);
  }
  Point rotate(double t) {
    double c = cos(t), s = sin(t);
    return Point(c * x - s * y, s * x + c * y);
  }
  Point reverseX(void) {
    return Point(-x, y);
  }
  Point reverseY(void) {
    return Point(x, -y);
  }
  Point unit(void) {
    return (*this).norm() == 0 ? Point(0, 0) : (*this) / (*this).norm();
  }
  Point floor(void) {
    return Point((int)x, (int)y);
  }
  double dot(const Point &q) {
    return x * q.x + y * q.y;
  }
  double det(const Point &q) {
    return x * q.y - y * q.x;
  }
  int sign(const Point &q) {
    double d = (*this).det(q);
    return (d > 0) - (d < 0);
  }
  bool on_seg(Point p1, Point p2, Point q) {
    return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
  }
  Point intersection(Point p1, Point p2, Point q1, Point q2) {
    return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
  }
};

int main() {
  int n;
  while (cin >> n, n) {
    int m = 1;
    double d;
    vector<Point> a(n);

    for (int i = 0; i < n; ++i) {
      scanf("%lf,%lf", &a[i].x, &a[i].y);
    }

    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (i != j && (d = (a[j] - a[i]).norm()) <= 2) {
          int c1 = 2, c2 = 2;
          d /= 2;
          Point e = (a[j] - a[i]).rotate(M_PI / 2).unit();
          Point p = (a[i] + a[j]) / 2 + e * sqrt(1 - d * d);
          Point q = (a[i] + a[j]) / 2 - e * sqrt(1 - d * d);
          if (fabs(p.x) <= 10 && fabs(p.y) <= 10) {
            for (int k = 0; k < n; ++k) {
              if (k != i && k != j && (p - a[k]).norm() <= 1) c1++;
            }
          }

          if (fabs(q.x) <= 10 && fabs(q.y) <= 10) {
            for (int k = 0; k < n; ++k) {
              if (k != i && k != j && (q - a[k]).norm() <= 1) c2++;
            }
          }

          m = max(m, max(c1, c2));
        }
      }
    }

    cout << m << endl;
  }
}