1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    map<int, array<int, 2>> M;
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        int r, a, b; cin >> r >> a >> b;
        ++M[a - b][r - 1];
    }
    int res = 0;
    for (const auto &[val, arr] : M)
        res += max(arr[0], arr[1]);
    cout << (n - res) << '\n';
}