#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  while (cin >> N && N) {
    vector<complex<double> > cs(N);
    for (int i = 0; i < (int)(N); ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      cs[i] = complex<double>(x, y);
    }
    int ans = 0;
    for (int i = 0; i < (int)(N); ++i) {
      int cnt = 0;
      for (int j = 0; j < (int)(N); ++j)
        if (abs(cs[i] - cs[j]) <= 2.0) ++cnt;
      ans = max(ans, cnt);
    }
    cout << ans << endl;
  }
  return 0;
}
