#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  while (cin >> n && n) {
    vector<double> x(n);
    vector<double> y(n);
    for (int i = 0; i < n; i++) {
      string line;
      cin >> line;
      replace(line.begin(), line.end(), ',', ' ');
      istringstream is(line);
      is >> x[i] >> y[i];
    }
    int kotae = 0;
    for (int i = 0; i < n; i++) {
      if ((x[i] - 1.0 < 0.0 || x[i] + 1.0 > 10.0) ||
          (y[i] - 1.0 < 0.0 || y[i] + 1.0 > 10.0))
        continue;
      int m = 0;
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        if ((x[j] - 1.0 < 0.0 || x[j] + 1.0 > 10.0) ||
            (y[j] - 1.0 < 0.0 || y[j] + 1.0 > 10.0))
          continue;
        double d =
            sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
        if (d <= 2.0) m++;
      }
      kotae = max(kotae, m + 1);
    }
    cout << kotae << endl;
  }
  return 0;
}
