#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int main() {
  int n;
  while (cin >> n, n) {
    long double x[n], y[n];
    for (int i = 0; i < (int)n; ++i) {
      cin >> x[i];
      cin.get();
      cin >> y[i];
    }
    int ans = 1;
    for (int i = 0; i < (int)n - 1; ++i) {
      for (int j = i + 1; j < n; j++) {
        long double dx = x[j] - x[i], dy = y[j] - y[i];
        if (dx * dx + dy * dy > 4) continue;
        int tans = 0;
        long double xm = (x[j] + x[i]) / 2, ym = (y[j] + y[i]) / 2;
        long double arufa = atan2(dy, dx),
                    beta = acos(sqrt((dx * dx + dy * dy)) / 2.0);
        long double kx = x[i] + cos(arufa + beta),
                    ky = y[i] + sin(arufa + beta);
        for (int j = 0; j < (int)n; ++j) {
          if (kx < 0 || kx > 10 || ky < 0 || ky > 10) continue;
          dx = kx - x[j], dy = ky - y[j];
          if (dx * dx + dy * dy <= 4) ++tans;
        }
        ans = max(ans, tans);
        tans = 0;
        kx = x[i] + cos(arufa - beta), ky = y[i] + sin(arufa - beta);
        for (int j = 0; j < (int)n; ++j) {
          if (kx < 0 || kx > 10 || ky < 0 || ky > 10) continue;
          dx = kx - x[j], dy = ky - y[j];
          if (dx * dx + dy * dy <= 1) ++tans;
        }
        ans = max(ans, tans);
      }
    }
    cout << ans << endl;
  }
}
