#include <bits/stdc++.h>
using namespace std;
int main() {
  double x, y;
  int n;
  while (cin >> n, n) {
    vector<complex<double> > V;
    string str;
    while (cin >> str, --n) {
      stringstream ss;
      for (int i = 0; i < str.size(); i++)
        if (str[i] == ',') str[i] = ' ';
      ss << str;
      ss >> x >> y;
      V.push_back(complex<double>(x, y));
    }
    int res = 0;
    for (auto i : V) {
      int count = 1;
      for (auto j : V) {
        if (i != j) {
          if (abs(i - j) - 2.0 < 0.0) count++;
        }
      }
      res = max(res, count);
    }
    cout << res << endl;
  }
  return 0;
}
