#include <bits/stdc++.h>
using namespace std;
double GetLength(double x1, double y1, double x2, double y2) {
  double X = x2 - x1, Y = y2 - y1;
  return sqrt(X * X + Y * Y);
}
int main(void) {
  string line;
  double x[101], y[101];
  while (true) {
    int n;
    getline(cin, line);
    istringstream is(line);
    is >> n;
    cin.clear();
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      getline(cin, line);
      replace(line.begin(), line.end(), ',', ' ');
      istringstream is(line);
      is >> x[i] >> y[i];
      cin.clear();
    }
    int answer = 0;
    for (int i = 0; i < n; i++) {
      int count = 1;
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        double length = GetLength(x[i], y[i], x[j], y[j]);
        if ((length > 2.0) == false) count++;
      }
      answer = max(answer, count);
    }
    cout << answer << endl;
  }
}
