#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
int main(void) {
  int n;
  while (cin >> n) {
    if (n == 0) break;
    double x[100], y[100];
    double d[100][100];
    vector<set<int> > overlap(n);
    for (int i = (0); i < (int)(n); ++i)
      for (int j = (0); j < (int)(n); ++j) d[i][j] = 100.0;
    for (int i = (0); i < (int)(n); ++i) {
      scanf("%lf,%lf", x + i, y + i);
    }
    for (int i = (0); i < (int)(n); ++i)
      for (int j = (i + 1); j < (int)(n); ++j) {
        double dist =
            sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
        if (dist < 2 + EPS) {
          overlap[i].insert(j);
          overlap[j].insert(i);
        }
      }
    int ans = 0;
    for (int i = (0); i < (int)(n); ++i) {
      set<int> cor = overlap[i];
      set<int>::iterator it = cor.begin();
      while (it != cor.end()) {
        set<int>::iterator it2 = it;
        it2++;
        while (it2 != cor.end()) {
          if (overlap[*it].find(*it2) == cor.end()) {
            cor.erase(*it2);
          }
          it2++;
        }
        it++;
      }
      ans = max(ans, (int)cor.size() + 1);
    }
    cout << ans << endl;
  }
  return 0;
}
