#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  vector<pair<double, double> > res;
  while (cin >> n && n) {
    double x, y;
    char c;
    for (int i = 0; i < n; i++) {
      cin >> x >> c >> y;
      res.push_back(make_pair(x, y));
    }
    int count;
    for (int i = 0; i < n; i++) {
      count = 0;
      for (int j = 0; j < n; j++) {
        if (i != j) {
          double temp = res[i].first - res[j].first;
          double temp2 = res[i].second - res[j].second;
          double dis = sqrt(temp * temp + temp2 * temp2);
          if (dis <= 2.0 + 1e-15) {
            count++;
          }
        }
      }
      ans = max(ans, count);
    }
    cout << ans + 1 << endl;
  }
  return 0;
}
