#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const int maxn = 5001;
int a[maxn][3];
int sol[3], can[3];
int t[3], tob[3];
int dp[2][90][90][90];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 0; j < (int)(3); ++j) {
      cin >> a[i][j];
      sol[j] += a[i][j] != 0;
      can[j] += a[i][j] < 0;
    }
  if (can[0] + can[1] + can[2] >= 90) {
    cout << 1 << '\n';
    return 0;
  }
  int ans = 1e9;
  for (t[0] = 0; t[0] < 6; ++t[0]) {
    for (t[1] = 0; t[1] < 6; ++t[1]) {
      for (t[2] = 0; t[2] < 6; ++t[2]) {
        bool ok = true;
        for (int i = 0; i < (int)(3); ++i) {
          tob[i] = min(
              can[i],
              max(0, (t[i] == 5 ? (int)1e9 : sol[i] - (n >> (t[i] + 1)) - 1)));
          int z = (sol[i] - tob[i]) << (t[i] + 1);
          ok &= ((t[i] == 5 || n < z) && z <= 2 * n);
        }
        if (!ok) continue;
        int myB = 0;
        for (int i = 0; i < (int)(3); ++i) {
          myB += 100 * tob[i];
          if (a[0][i]) myB += 2 * (t[i] + 1) * (250 - a[0][i]);
        }
        for (int i = 0; i < (int)(tob[0] + 1); ++i)
          for (int j = 0; j < (int)(tob[1] + 1); ++j)
            for (int k = 0; k < (int)(tob[2] + 1); ++k) dp[0][i][j][k] = 1e9;
        dp[0][tob[0]][tob[1]][tob[2]] = 0;
        int twin = 0;
        for (int p = 1; p <= (int)(n - 1); ++p) {
          bool ist = true;
          for (int m = 0; m < (int)(3); ++m) ist &= a[p][m] >= 0;
          if (ist) {
            int hisb = 0;
            for (int m = 0; m < (int)(3); ++m) {
              if (a[p][m]) hisb += 2 * (t[m] + 1) * (250 - abs(a[p][m]));
            }
            if (hisb > myB) ++twin;
            continue;
          }
          for (int i = 0; i < (int)(tob[0] + 1); ++i)
            for (int j = 0; j < (int)(tob[1] + 1); ++j)
              for (int k = 0; k < (int)(tob[2] + 1); ++k) dp[1][i][j][k] = 1e9;
          for (int i = 0; i < (int)(tob[0] + 1); ++i)
            for (int j = 0; j < (int)(tob[1] + 1); ++j)
              for (int k = 0; k < (int)(tob[2] + 1); ++k) {
                for (int ti = 0; ti < (int)(2); ++ti)
                  for (int tj = 0; tj < (int)(2); ++tj)
                    for (int tk = 0; tk < (int)(2); ++tk) {
                      if (ti && (!i || a[p][0] >= 0)) continue;
                      if (tj && (!j || a[p][1] >= 0)) continue;
                      if (tk && (!k || a[p][2] >= 0)) continue;
                      int hisB = 0;
                      if (a[p][0] && !ti)
                        hisB += 2 * (t[0] + 1) * (250 - abs(a[p][0]));
                      if (a[p][1] && !tj)
                        hisB += 2 * (t[1] + 1) * (250 - abs(a[p][1]));
                      if (a[p][2] && !tk)
                        hisB += 2 * (t[2] + 1) * (250 - abs(a[p][2]));
                      uin(dp[1][i - ti][j - tj][k - tk],
                          dp[0][i][j][k] + (hisB > myB));
                    }
              }
          for (int i = 0; i < (int)(tob[0] + 1); ++i)
            for (int j = 0; j < (int)(tob[1] + 1); ++j)
              for (int k = 0; k < (int)(tob[2] + 1); ++k)
                dp[0][i][j][k] = dp[1][i][j][k];
        }
        uin(ans, twin + dp[0][0][0][0]);
      }
    }
  }
  cout << ans + 1 << '\n';
  return 0;
}
