## Problem 3: Guardians of the Cash

With the fate of the entire galaxy on the line, the Guardians of the Galaxy have naturally been called in to battle against Thanos as well! That being said, their leader, Star-Lord, has realized the potential for a bit of financial compensation along the way. He's successfully secured a hefty stash of solid gold coins for his team before any fighting has even begun!

While waiting for the action to finally get underway, Rocket Raccoon and Groot have decided to amuse themselves with a game involving the coins. For starters, they've drawn a grid on the ground with N rows and N columns (1 ≤ N ≤ 1000). Then, in each cell (i, j) (the cell in the i-th row and j-th column), they've placed a stack of Ci, j (1 ≤ Ci, j ≤ 109) coins.

If you look at the resulting coin collection from the South (from beyond row 1), all you can make out is the shape of its "skyline". This Southern skyline is a sequence of N positive integers, the i-th of which is the number of coins in the tallest stack in the i-th column. Similarly, its Western skyline (when viewed from beyond column 1) is a sequence of N positive integers, the i-th of which is the number of coins in the tallest stack in the i-th row.

For example, consider the following arrangement of stack heights:

```2 3 2
4 5 4
5 1 2
```

Its Southern skyline sequence is {5, 5, 4}, while its Western skyline sequence is {3, 5, 5}.

Rocket Raccoon now poses the following challenge to Groot: Remove 0 or more coins from the collection such that it will look exactly the same from the South as from the West (in other words, such that its Southern skyline sequence will be equal to its Western skyline sequence). Groot has a bit of trouble lifting the heavy gold coins, so he'd like to pass Rocket Raccoon's challenge while removing as few of them as possible. What's the minimum number of coins which he must remove from the stacks in total? Note that this value may not fit into a 32-bit signed integer.

In test cases worth 9/28 of the points, N ≤ 200 and Ci, j ≤ 2 for each cell (i, j).
In test cases worth another 9/28 of the points, N ≤ 200.

### Input Format

The first line of input consists of a single integer, N.
N lines follow, the i-th of which consists of integers, Ci, 1..N, for i = 1..N.

### Output Format

Output a single integer, the minimum number of coins which Groot must remove.

```3
2 3 2
4 5 4
5 1 2
```

```4
```

### Sample Explanation

One option is for Groot to remove one coin from the stack in cell (2, 1), one coin from (2, 3), and two coins from (3, 1), resulting in the following arrangement of stack heights:

```2 3 2
3 5 3
3 1 2
```

Note that both its Southern and Western skyline sequences are equal to {3, 5, 3}.

Point Value: 15 (partial)
Time Limit: 4.00s
Memory Limit: 64M