#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long double INF = 1e10;
const long double PI = M_PI;
struct Point {
  long double x, y;
  Point(long double x, long double y) : x(x), y(y) {}
  Point() {}
};
Point operator+(const Point &a, const Point &b) {
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point &a, const Point &b) {
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point &a, const long double b) {
  return Point(a.x * b, a.y * b);
}
Point operator*(const Point &a, const Point &b) {
  return Point(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
Point operator/(const Point &a, const long double b) {
  return Point(a.x / b, a.y / b);
}
long double dot(const Point &a, const Point &b) {
  return a.x * b.x + a.y * b.y;
}
long double norm(const Point &a) { return dot(a, a); }
bool operator<(const Point &a, const Point &b) {
  return make_pair(a.x, a.y) < make_pair(b.x, b.y);
}
bool operator==(const Point &a, const Point &b) {
  return a.x == b.x && a.y == b.y;
}
long double atan(const Point &a) { return atan2(a.y, a.x); }
long double abs(const Point &a) { return sqrt(norm(a)); }
struct Circle : Point {
  long double r;
  Circle(Point p = Point(0, 0), long double r = 0) : Point(p), r(r) {}
};
bool is_intersect_CC(const Circle &c, const Circle &d) {
  return abs(c - d) <= c.r + d.r + EPS && abs(c - d) >= abs(c.r - d.r) + EPS;
}
int main() {
  int n;
  while (cin >> n, n) {
    long double x, y;
    char c;
    vector<Circle> C;
    for (int i = 0; i < n; i++) {
      cin >> x >> c >> y;
      C.push_back(Circle(Point(x, y), 1.0));
    }
    int overlap[110];
    memset(overlap, 0, sizeof(overlap));
    for (int i = 0; i < (int)C.size(); i++) {
      for (int j = i + 1; j < (int)C.size(); j++) {
        if (is_intersect_CC(C[i], C[j])) overlap[i]++, overlap[j]++;
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) ans = max(ans, overlap[i]);
    cout << ans + 1 << endl;
  }
  return 0;
}
