#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
int main(void) {
  int n;
  while (cin >> n) {
    if (n == 0) break;
    double x[100], y[100];
    double d[100][100];
    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]));
        d[i][j] = d[j][i] = dist;
      }
    int ans = 1;
    set<int> gr;
    for (int i = (0); i < (int)(n); ++i)
      for (int j = (i + 1); j < (int)(n); ++j) {
        if (d[i][j] <= 2) {
          gr.clear();
          gr.insert(i);
          gr.insert(j);
        }
        bool f = false;
        do {
          f = false;
          for (int k = (0); k < (int)(n); ++k) {
            if (gr.find(k) != gr.end()) continue;
            set<int>::iterator it = gr.begin();
            bool f2 = true;
            for (; it != gr.end(); it++) {
              if (d[k][*it] > 2) {
                f2 = false;
                break;
              }
            }
            if (f2) {
              f = true;
              gr.insert(k);
            }
          }
        } while (f);
        ans = max(ans, (int)gr.size());
      }
    cout << ans << endl;
  }
  return 0;
}
