#include <bits/stdc++.h>
using namespace std;
const int nmax = 100;
double px[nmax];
double py[nmax];
inline double dis(double x1, double y1, double x2, double y2) {
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
}
int main() {
  int n;
  char c;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> px[i] >> c >> py[i];
    }
    int max_count = 1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        double d = dis(px[i], py[i], px[j], py[j]);
        if (d > 4.0) break;
        int count = 0;
        double px1, py1;
        double px2, py2;
        double mx, my;
        double d2 = 1.0 - (d / 4.0);
        double dx, dy;
        double dx2, dy2;
        mx = (px[i] + px[j]) / 2;
        my = (py[i] + py[j]) / 2;
        dy = px[i] - px[j];
        dx = -(py[i] - py[j]);
        dx2 = dx / sqrt(dx * dx + dy * dy) * sqrt(d2);
        dy2 = dy / sqrt(dx * dx + dy * dy) * sqrt(d2);
        px1 = mx + dx2;
        px2 = mx - dx2;
        py1 = mx + dy2;
        py2 = mx - dy2;
        for (int k = 0; k < n; k++) {
          d = dis(px1, py1, px[k], py[k]);
          if (d < 1.00000001 && d > 0.99999999) count++;
        }
        if (count > max_count) max_count = count;
        count = 0;
        for (int k = 0; k < n; k++) {
          d = dis(px2, py2, px[k], py[k]);
          if (d < 1.00000001 && d > 0.99999999) count++;
        }
        if (count > max_count) max_count = count;
      }
    }
    cout << max_count << endl;
  }
  return 0;
}
