#include <bits/stdc++.h>
using namespace std;
template <class T>
int __builtin_popcount(T n) {
  return n ? 1 + __builtin_popcount(n & (n - 1)) : 0;
}
const int iINF = 2147483647;
const long long lINF = 9223372036854775807;
template <class T>
inline void dbg(T t) {
  cout << t << endl;
}
double EPS = 1e-10;
struct Point2D {
  double x, y;
  Point2D(double a = 0, double b = 0) : x(a), y(b) {}
};
Point2D operator+(Point2D a, Point2D b) {
  return Point2D(a.x + b.x, a.y + b.y);
}
Point2D operator-(Point2D a, Point2D b) {
  return Point2D(a.x - b.x, a.y - b.y);
}
Point2D operator*(Point2D a, double d) { return Point2D(a.x * d, a.y * d); }
Point2D operator/(Point2D a, double d) { return Point2D(a.x / d, a.y / d); }
bool operator<(const Point2D& a, const Point2D& b) {
  return a.x != b.x ? a.x < b.x : a.y < b.y;
}
bool operator>(const Point2D& a, const Point2D& b) {
  return b.x != a.x ? b.x < a.x : b.y < a.y;
}
bool operator==(const Point2D& a, const Point2D& b) {
  return fabs(a.x - b.x) < EPS && fabs(a.y - b.y) < EPS;
}
double norm(Point2D a) { return a.x * a.x + a.y * a.y; }
double dot2D(const Point2D& a, const Point2D& b) {
  return a.x * b.x + a.y * b.y;
}
double cross2D(const Point2D& a, const Point2D& b) {
  return a.x * b.y - a.y * b.x;
}
double dist2D(const Point2D& a, const Point2D& b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
bool is_vertical(const Point2D& a, const Point2D& b) {
  return fabs(dot2D(a, b)) < EPS;
}
bool is_parrallel(const Point2D& a, const Point2D& b) {
  return fabs(cross2D(a, b)) < EPS;
}
struct Line {
  Point2D s, e;
  Line(double _x = 0, double _y = 0, double x_ = 0, double y_ = 0) {
    s.x = _x;
    s.y = _y;
    e.x = x_;
    e.y = y_;
  }
};
bool is_cross(const Line& a, const Line& b) {
  return (cross2D(a.e - a.s, b.s - a.s) * cross2D(a.e - a.s, b.e - a.s) <
          EPS) &&
         (cross2D(b.e - b.s, a.s - b.s) * cross2D(b.e - b.s, a.e - b.s) < EPS);
}
bool is_parrallel(const Line& a, const Line& b) {
  return is_parrallel(a.s - a.e, b.s - b.e);
}
Point2D crossPoint(const Line& l1, const Line& l2) {
  Point2D b = l2.e - l2.s;
  double d1 = fabs(cross2D(b, l1.s - l2.s));
  double d2 = fabs(cross2D(b, l1.e - l2.s));
  double t = d1 / (d1 + d2);
  return l1.s + (l1.e - l1.s) * t;
}
double point_line_dist(const Point2D& A, const Line& l) {
  double a = (l.s.y - l.e.y) / (l.s.x - l.e.x);
  double c = (-1) * a * l.s.x - l.s.y;
  return fabs(a * A.x + A.y + c) / sqrt(a * a + 1.0);
}
Point2D line_symmetry(const Point2D& A, const Line& l) {
  complex<double> p1(l.s.x, l.s.y), p2(l.e.x, l.e.y), q(A.x, A.y);
  complex<double> r = p1 + polar(abs(q - p1), 2 * arg(p2 - p1) - arg(q - p1));
  Point2D ret(r.real(), r.imag());
  return ret;
}
struct Circle {
  Point2D c;
  double r;
  Circle(double a = 0, double b = 0, double rr = 0) {
    c.x = a;
    c.y = b;
    r = rr;
  }
};
bool point_in_circle(const Point2D& p, const Circle& t) {
  double dist = dist2D(p, t.c);
  return (dist <= t.r);
}
int circle_intersect(const Circle& a, const Circle& b) {
  double dist = dist2D(a.c, b.c);
  if (a.r + b.r < dist) return 0;
  if (dist + b.r < a.r) return 2;
  if (dist + a.r < b.r) return -2;
  return 1;
}
int solve(vector<Circle> circles, int n) {
  vector<vector<Circle> > group(n);
  for (int i = (int)0; i < (int)n; i++) {
    bool flag = false;
    int last_group = -1;
    for (int j = (int)0; j < (int)n; j++) {
      if ((int)group[j].size() == 0) {
        last_group = j;
        break;
      }
      for (int k = (int)0; k < (int)(int)group[j].size(); k++) {
        if (circle_intersect(circles[i], group[j][k]) != 0) flag = true;
      }
      if (flag) {
        group[j].push_back(circles[i]);
        break;
      }
    }
    if (!flag) {
      group[last_group].push_back(circles[i]);
    }
  }
  int ans = 0;
  for (int i = (int)0; i < (int)n; i++) ans = max(ans, (int)group[i].size());
  return ans;
}
int main() {
  int n;
  while (1) {
    cin >> n;
    if (n == 0) break;
    vector<Circle> circles(n);
    for (int i = (int)0; i < (int)n; i++) {
      double x, y;
      char c;
      cin >> x >> c >> y;
      Circle circle(x, y, 1);
      circles[i] = circle;
    }
    cout << solve(circles, n) << endl;
  }
  return 0;
}
