#include <bits/stdc++.h>
using namespace std;
double add(double a, double b) {
  if (abs(a + b) < 1e-15 * (abs(a) + abs(b))) return 0;
  return a + b;
}
struct P {
  double x, y;
  P() {}
  P(double x, double y) : x(x), y(y) {}
  P operator+(P p) { return P(add(x, p.x), add(y, p.y)); }
  P operator-(P p) { return P(add(x, -p.x), add(y, -p.y)); }
  P operator*(double d) { return P(x * d, y * d); }
  double dot(P p) { return add(x * p.x, y * p.y); }
  double det(P p) { return add(x * p.y, -y * p.x); }
};
double dist(P p, P q) { return sqrt((p - q).dot(p - q)); }
P now;
double cmp_x(const P& p, const P& q) { return dist(p, now) < dist(q, now); }
int main() {
  P p[101];
  int n;
  char c;
  while (cin >> n, n) {
    for (int i = 0; i < n; i++) {
      cin >> p[i].x >> c >> p[i].y;
    }
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    P t[101];
    int mx = 1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) t[j] = p[j];
      now = p[i];
      sort(t, t + n, cmp_x);
      int k = 1;
      while (dist(now, t[k]) - 2.0 < 1e-15 && k < n) k++;
      mx = max(k, mx);
    }
    cout << mx << endl;
  }
}
