#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int N;
    cin >> N;
    vector<vector<int>> C(N, vector<int>(N));
    REP (i, 0, N) REP (j, 0, N) cin >> C[i][j];
    lli ans = 0;
    REP (i, 1, N) REP (j, 0, i) ans += min(C[i][j], C[j][i]);
    cout << ans << endl;
    return 0;
}