#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

int main(){
    int n;
    long long a[100][100];
    cin >> n;
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    long long sum = 0;
    rep(i,n - 1){
        range(j,i + 1,n){
            sum+=min(a[i][j], a[j][i]);
        }
    }
    cout << sum << endl;
}