#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
template <class T>
T RoundOff(T a) {
  return int(a + .5 - (a < 0));
}
template <class T, class C>
void chmax(T& a, C b) {
  if (a < b) a = b;
}
template <class T, class C>
void chmin(T& a, C b) {
  if (b < a) a = b;
}
template <class T, class C>
pair<T, C> mp(T a, C b) {
  return make_pair(a, b);
}
struct P {
  double x, y;
};
int main() {
  int n;
  while (cin >> n && n) {
    vector<P> c(n);
    char k;
    for (int i = 0; i < n; i++) cin >> c[i].x >> k >> c[i].y;
    int res = 0;
    for (int i = 0; i < n; i++) {
      int now = 0;
      for (int j = 0; j < n; j++) {
        now += (pow(c[i].x - c[j].x, 2.0) + pow(c[i].y - c[j].y, 2.0) <= 4.0);
      }
      chmax(res, now);
    }
    cout << res << endl;
  }
}
