#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100;
class Vector2D {
 public:
  double x, y;
  Vector2D(double x = 0, double y = 0) : x(x), y(y) {}
  Vector2D operator+(Vector2D other) {
    return Vector2D(x + other.x, y + other.y);
  }
  Vector2D operator-(Vector2D other) {
    return Vector2D(x - other.x, y - other.y);
  }
  double r2() { return x * x + y * y; }
};
void solve(int n);
int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) break;
    cin.ignore();
    solve(n);
  }
  return 0;
}
void solve(int n) {
  Vector2D points[MAX_N];
  int adj[MAX_N * (MAX_N - 1) / 2] = {0};
  int sum[MAX_N - 1] = {0};
  int adj_start, adj_end;
  int i, j;
  auto get_adj_start = [n](int i) { return i * (n - 1) - i * (i - 1) / 2; };
  for (i = 0; i < n; i++) {
    double x, y;
    string line;
    int delim_pos;
    getline(cin, line);
    delim_pos = line.find_first_of(',');
    x = atof(line.substr(0, delim_pos).data());
    y = atof(line.substr(delim_pos + 1).data());
    points[i] = Vector2D(x, y);
  }
  for (i = 0; i < n - 1; i++) {
    adj_start = get_adj_start(i);
    for (j = i + 1; j < n; j++) {
      if ((points[j] - points[i]).r2() <= 4) {
        adj[adj_start + j] = 1;
      }
    }
  }
  for (i = 0; i < n - 1; i++) {
    adj_start = get_adj_start(i);
    adj_end = adj_start + n - i - 1;
    for (j = adj_start; j < adj_end; j++) sum[i] += adj[j];
  }
  cout << *max_element(sum, sum + n - 1) + 1 << endl;
}
