#include <bits/stdc++.h>
using namespace std;
double x[100], y[100];
inline double dis(int a, int b) {
  return sqrt((x[b] - x[a]) * (x[b] - x[a]) + (y[b] - y[a]) * (y[b] - y[a]));
}
int cnt[100];
int main() {
  int n;
  while (scanf("%d", &n), n) {
    for (int i = 0; i < 100; i++) {
      x[i] = 0.0;
      y[i] = 0.0;
      cnt[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
      for (int j = 0; j < i; j++) {
        if (dis(i, j) <= 2.000001) {
          cnt[i]++;
          cnt[j]++;
        }
      }
    }
    int maxi = 0;
    for (int i = 0; i < n; i++) {
      maxi = max(maxi, cnt[i]);
    }
    printf("%d\n", maxi + 1);
  }
  return 0;
}
