#include #define rep(x, to) for (int x = 0; x < (to); x++) #define REP(x, a, to) for (int x = (a); x < (to); x++) #define EPS (1e-14) #define _PA(x,N) rep(i,N){cout< PII; typedef pair PLL; typedef complex Complex; typedef vector< vector > Mat; int ans; int N; pair< int, pair > xyz[1005], prev_xyz; void solve() { sort(xyz, xyz+N); rep(i, N) { if (prev_xyz.fst < xyz[i].fst && prev_xyz.snd.fst < xyz[i].snd.fst && prev_xyz.snd.snd < xyz[i].snd.snd) { ans++; prev_xyz = xyz[i]; } } cout << ans << endl; } int main() { cin >> N; rep(i, N) { int x[3]; cin >> x[0] >> x[1] >> x[2]; sort(x, x+3); xyz[i].fst = x[0]; xyz[i].snd.fst = x[1]; xyz[i].snd.snd = x[2]; } solve(); return 0; }