You are playing a game called "Rhythm Sin". In this game, you control partners to explore the "World".
Each partner has three attributes: $$$\mathrm{Stop}$$$ (S), $$$\mathrm{Flag}$$$ (F), and $$$\mathrm{Ever}$$$ (E). When all partners' attributes are completely consistent, they can successfully fuse.
Your goal is to fuse all partners, meaning you must make every pair of partners have identical attributes. To achieve this, you need to modify their attributes. Each modification consists of the following steps:
Due to limited magical power, each modification costs $$$1$$$ primal stone. Your task is to determine the minimum number of primal stones required to achieve your goal.
The first line contains an integer $$$N$$$ ($$$1\le N\le 10^5$$$), the number of partners.
The next $$$N$$$ lines each contain three integers $$$S_i$$$, $$$F_i$$$, and $$$E_i$$$ ($$$1\le S_i, F_i, E_i \le 10^5$$$), separated by a space, representing the values of the three attributes for the $$$i$$$-th partner.
A single integer representing the minimum number of primal stones required.
32 2 22 2 21 2 3
2
32 3 13 5 33 2 1
4
1201 502 10
0
41 2 31 2 34 5 64 5 6
6
For the first sample, one possible sequence of modifications (costing $$$2$$$ primal stones) is:
It can be proved that you cannot achieve the goal using less than $$$2$$$ primal stones, so the answer is $$$2$$$.
For the second sample, one possible sequence of modifications (costing $$$4$$$ primal stones) is:
It can be proved that you cannot achieve the goal using less than $$$4$$$ primal stones, so the answer is $$$4$$$.
For the third sample, because there is only one partner, you don't need to perform any modifications, so the answer is $$$0$$$.
| Name |
|---|


