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