#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  float x, y;
  vector<complex<double> > p;
  vector<int> num;
  while (cin >> n, n) {
    p.resize(n);
    num.resize(n);
    for (int i = 0; i < n; ++i) {
      scanf("%f,%f", &x, &y);
      p[i] = complex<double>(x, y);
      num[i] = 1;
    }
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        if ((p[i].real() - p[j].real()) * (p[i].real() - p[j].real()) +
                (p[i].imag() - p[j].imag()) * (p[i].imag() - p[j].imag()) <=
            4.0f) {
          ++num[i];
          ++num[j];
        }
      }
    }
    cout << *max_element(num.begin(), num.end()) << endl;
  }
  return 0;
}
