#include <bits/stdc++.h>
const int INF = 10000000;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
using namespace std;
typedef struct {
  double x, y;
} Point;
int main() {
  int N;
  while (cin >> N, N) {
    vector<Point> points;
    for (int k = 0; k < (int)(N); k++) {
      Point p;
      char c;
      cin >> p.x >> c >> p.y;
      points.push_back(p);
    }
    int ans = 1;
    for (int i = 0; i < (int)(N); i++) {
      int tmp = 1;
      double x1 = points[i].x, y1 = points[i].y;
      for (int j = 0; j < (int)(N); j++) {
        if (i != j) {
          double x2 = points[j].x, y2 = points[j].y;
          if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) <= 4) tmp++;
        }
      }
      ans = max(ans, tmp);
    }
    cout << ans << endl;
  }
}
