#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long MOD = 1e9 + 7;
double EPS = 1e-7;
bool check(double x1, double y1, double x2, double y2) {
  double dx = x1 - x2, dy = y1 - y2;
  return dx * dx + dy * dy <= 1 + EPS;
}
int main() {
  int n;
  char cc;
  while (cin >> n && n) {
    vector<pair<double, double> > v;
    pair<double, double> p;
    vector<pair<double, double> > c;
    double x, y;
    for (int i = (0); i < (int)(n); i++) {
      cin >> x >> cc >> y;
      v.push_back(make_pair(x - 1, y));
      v.push_back(make_pair(x + 1, y));
      v.push_back(make_pair(x, y - 1));
      v.push_back(make_pair(x, y + 1));
      c.push_back(make_pair(x, y));
    }
    sort(v.begin(), v.end());
    int tmp = 0, ans = 0;
    for (int i = 0; i < v.size(); i++) {
      tmp = 0;
      for (int j = 0; j < c.size(); j++) {
        if (check(v[i].first, v[i].second, c[j].first, c[j].second)) {
          tmp++;
        }
      }
      ans = max(ans, tmp);
    }
    cout << ans << endl;
  }
}
