//KZNS
#include <cstdio>
#include <algorithm>
using namespace std;
int ls[1003][4];
bool mp[50][50][50][50];
int N;
int main() {
freopen("xumingshi.in", "r", stdin);
freopen("xumingshi.out", "w", stdout);
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d %d %d %d", &ls[i][0], &ls[i][1], &ls[i][2], &ls[i][3]);
mp[ls[i][0] += 20][ls[i][1] += 20][ls[i][2] += 20][ls[i][3] += 20] = true;
}
int ans = 0;
int mx;
int a, b, c, d;
int q, w, e, r;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (i == j)
continue;
mx = 2;
a = ls[j][0] - ls[i][0];
b = ls[j][1] - ls[i][1];
c = ls[j][2] - ls[i][2];
d = ls[j][3] - ls[i][3];
q = ls[j][0] + a;
w = ls[j][1] + b;
e = ls[j][2] + c;
r = ls[j][3] + d;
while (q >= 0 && w >= 0 && e >= 0 && r >= 0 &&
q <= 40 && w <= 40 && e <= 40 && r <= 40) {
if (mp[q][w][e][r])
mx++;
q += a;
w += b;
e += c;
r += d;
}
ans = max(ans, mx);
}
}
printf("%d\n", ans);
return 0;
}
//UBWH