#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main() {
  int n;
  cin>>n;
  vector<vector<int>> t(n,vector<int>(n));
  REP(i,n)REP(j,n) cin>>t[i][j];
  int64_t sum = 0;
  REP(i,n)REP(j,i) {
    sum += min(t[i][j], t[j][i]);
  }
  cout<<sum<<endl;
  return 0;
}