#include <bits/stdc++.h>
using namespace std;
int n, ans;
double x[101], y[101], a[101][101];
int main() {
  while (cin >> n, n) {
    ans = 0;
    for (int i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    for (int i = 0; i < 10000; i++)
      for (int j = 0; j < 10000; j++) {
        int a = 0;
        for (int k = 0; k < n; k++)
          if ((x[k] - (double)i / 10) * (x[k] - (double)i / 10) +
                  (y[k] - (double)j / 10) * (y[k] - (double)j / 10) <=
              1)
            a++;
        ans = max(a, ans);
      }
    cout << ans << endl;
  }
}
