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