#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  while (scanf("%d", &N) && N) {
    vector<pair<double, double> > vec;
    double x, y;
    for (int i = 0; i < N; i++) {
      scanf("%lf,%lf", &x, &y);
      vec.push_back(pair<double, double>(x, y));
    }
    int max = 0;
    for (int i = 0; i < N; i++) {
      int cnt = 0;
      pair<double, double> a = vec[i];
      for (int j = 0; j < N; j++) {
        if (i == j) continue;
        pair<double, double> b = vec[j];
        x = (a.first - b.first) * (a.first - b.first);
        y = (a.second - b.second) * (a.second - b.second);
        if (x + y <= 4) cnt++;
      }
      max = std::max(max, cnt + 1);
    }
    printf("%d\n", max);
  }
  return 0;
}
