#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <complex>
#include <string>
#include <sstream>
#include <iomanip>
#include <climits>
#include <functional>
#include <bitset>
#include <tuple>

using namespace std;

typedef long long  ll;

int main()
{
    int N;

    cin >> N;
    int c[N][N];

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            cin >> c[i][j];

    ll res = 0;
    for (int i = 0; i < N; ++i)
        for (int j = i + 1; j < N; ++j)
            res += min(c[i][j], c[j][i]);

    cout << res << endl;

    return 0;
}