#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x;
  int y;
};
vector<Point> points;
long distance_2(Point p1, Point p2) {
  long d2 = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y);
  return d2;
}
long precision = 10;
int count_in_circle(Point target, vector<Point> points) {
  int count = 0;
  for (Point p : points) {
    if (distance_2(target, p) <= precision * precision) count++;
  }
  return count;
}
int main() {
  int n;
  int cell_count = precision * 10;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < n; ++i) {
      Point p;
      double x;
      double y;
      scanf("%lf,%lf", &x, &y);
      p.x = static_cast<int>(x * precision);
      p.y = static_cast<int>(y * precision);
      points.push_back(p);
    }
    int count = 0;
    for (int k = 0; k <= cell_count; ++k) {
      for (int i = 0; i <= cell_count; ++i) {
        int count_tmp = count_in_circle(Point{k, i}, points);
        if (count_tmp > count) count = count_tmp;
      }
    }
    cout << count << endl;
  }
  return 0;
}
