#include using namespace std; typedef tuple T; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector b(n); for (int i = 0; i < n; i++) { int d[3]; for (int j = 0; j < 3; j++) cin >> d[j]; sort(d, d + 3); b[i] = tie(d[0], d[1], d[2]); } sort(b.begin(), b.end()); int ans = 0; int px = 0, py = 0, pz = 0; for (int i = 0; i < n; i++) { int x, y, z; tie(x, y, z) = b[i]; if (px < x && py < y && pz < z) { ans++; px = x; py = y; pz = z; } } cout << ans << endl; return 0; }