#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x;
  double y;
};
vector<Point> points;
double distance(Point p1, Point p2) {
  double d2 = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y);
  double d = abs(sqrt(d2));
  return d;
}
int main() {
  int n;
  int max_count_total = 0;
  while (cin >> n) {
    if (n == 0) break;
    int max_count;
    for (int i = 0; i < n; ++i) {
      Point p;
      scanf("%lf,%lf", &p.x, &p.y);
      points.push_back(p);
    }
    for (Point p1 : points) {
      int count = 0;
      for (Point p2 : points) {
        double d = distance(p1, p2);
        if (d <= 2.0) {
          count++;
        }
      }
      if (count > max_count) max_count = count;
    }
    if (max_count > max_count_total) max_count_total = max_count;
  }
  cout << max_count_total << endl;
  return 0;
}
