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