#include <bits/stdc++.h>
using namespace std;
int main() {
  double sx[100];
  double sy[100];
  double x, y;
  int i, j, n, cnt, max_cnt;
  while (true) {
    max_cnt = 0;
    cin >> n;
    if (n == 0) break;
    for (i = 0; i < n; i++) {
      scanf("%lf,%lf", &sx[i], &sy[i]);
    }
    for (i = 0; i < n; i++) {
      cnt = 0;
      for (j = 0; j < n; j++) {
        x = sx[i] - sx[j];
        y = sy[i] - sy[j];
        if ((x * x + y * y) < 4) {
          cnt++;
        }
      }
      if (max_cnt < cnt) {
        max_cnt = cnt;
      }
    }
    cout << max_cnt << endl;
  }
  return 0;
}
