#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    vector<pair<double, double> > points(n);
    for (int i = (int)(0); i < (int)(n); i++) {
      string buffer;
      cin >> buffer;
      buffer[buffer.find(',')] = ' ';
      istringstream(buffer) >> points[i].first >> points[i].second;
    }
    int max = 0;
    for (int i = (int)(0); i < (int)(n); i++) {
      int curr = 0;
      for (int j = (int)(0); j < (int)(n); j++) {
        if (sqrt(pow(points[i].first - points[j].first, 2) +
                 pow(points[i].second - points[j].second, 2)) <= 2) {
          curr++;
        }
      }
      max = std::max(max, curr);
    }
    cout << max;
  }
  return 0;
}
