#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n, n) {
    vector<complex<double>> p(n);
    for (int i = 0; i < (n); i++) {
      double x, y;
      char g;
      cin >> x >> g >> y;
      p[i] = complex<double>(x, y);
    }
    int maxi = 1;
    for (int i = 0; i < (n); i++) {
      for (int j = (i + 1); j < (n); j++) {
        if (abs(p[i] - p[j]) > 2.0) continue;
        int cnt = 0;
        for (int k = 0; k < (n); k++) {
          if (abs(p[i] - p[k]) <= 2.0 and abs(p[j] - p[k]) <= 2.0) cnt++;
        }
        maxi = max(cnt, maxi);
      }
    }
    cout << maxi << endl;
  }
}
