#include <stdio.h>

//#define PROBLEM_ID          "pencils"
#define MAXN                1000
#define MAX_HASH            384961

int x1[MAXN], y1[MAXN], x2[MAXN], y2[MAXN];
int xx1[MAXN], yy1[MAXN], xx2[MAXN], yy2[MAXN];

int hdx[MAXN * MAXN];
int hdy[MAXN * MAXN];
int next[MAXN * MAXN];
int ans[MAXN * MAXN];
int head[MAX_HASH];
int curSize = 0;

int main() {
    int max, n, i, j, cur, tmp, dx, dy, hash;

//    freopen(PROBLEM_ID".in", "r", stdin);
//    freopen(PROBLEM_ID".out", "w", stdout);

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d %d %d %d", &x1[i], &y1[i], &x2[i], &y2[i]);
        if (x1[i] > x2[i] || ((x1[i] == x2[i]) && (y1[i] > y2[i]))) {
            tmp = x1[i];
            x1[i] = x2[i];
            x2[i] = tmp;
            tmp = y1[i];
            y1[i] = y2[i];
            y2[i] = tmp;
        }
    }
    for (i = 0; i < n; i++) {
        scanf("%d %d %d %d", &xx1[i], &yy1[i], &xx2[i], &yy2[i]);
        if (xx1[i] > xx2[i] || ((xx1[i] == xx2[i]) && (yy1[i] > yy2[i]))) {
            tmp = xx1[i];
            xx1[i] = xx2[i];
            xx2[i] = tmp;
            tmp = yy1[i];
            yy1[i] = yy2[i];
            yy2[i] = tmp;
        }
    }

    for (i = 0; i < MAX_HASH; i++) {
        head[i] = -1;
    }

    max = 0;
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            dx = xx1[j] - x1[i];
            dy = yy1[j] - y1[i];
            if (x2[i] + dx != xx2[j] || y2[i] + dy != yy2[j])
                continue;

            hash = (dx << 16) ^ dy;
            hash = (hash < 0) ? -hash : hash;
            hash = hash % MAX_HASH;

            cur = head[hash];
            while (cur != -1) {
                if ((hdx[cur] == dx) && (hdy[cur] == dy)) {
                    ans[cur]++;
                    max = (max > ans[cur]) ? max : ans[cur];
                    break;
                }
                cur = next[cur];
            }
            if (cur == -1) {
                hdx[curSize] = dx;
                hdy[curSize] = dy;
                ans[curSize] = 1;
                max = (max > 1) ? max : 1;
                next[curSize] = head[hash];
                head[hash] = curSize;
                curSize++;
            }
        }
    }

    printf("%d\n", n - max);
    return 0;
}
