#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
#include<tuple>
#include<iomanip>
#include<stack>
#include<cmath>
#define ll long long
using namespace std;
int main() {
	int n; cin >> n;
	int data[100][100];
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j) cin >> data[i][j];
	ll sum = 0;
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j) sum += min(data[i][j], data[j][i]);
	cout << sum << endl;
	return 0;
}
