#include <iostream>
#include <vector>
using namespace std;
/*
int rec(vector<int> t, int s, int g, int N, vector< vector<int> > C){
  bool f = true;
  for(int i = 0; i < N; ++i){
    if(t[i]){
      f = false;
      break;
    }
  }

  if(f) return C[s][g];
  
  int ret = 0;
  for(int i = 0; i < N; ++i){
    if(t[i]){
      vector<int> t_ = t;
      t_[i] = 0;
      ret = max(ret,rec(t_,i,g,N,C) + C[s][i]);
    }
  }
  return ret;
}

int main(){
  int N;
  cin >> N;
  vector< vector<int> > C(N,vector<int>(N));
  int sum = 0;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j){
      cin >> C[i][j];
      sum += C[i][j];
    }
  }
  int ans = 0;
  vector<int> init(N,1);
  for(int i = 0; i < N; ++i){

    vector<int> t = init;
    t[i] = 0;
    //cout << rec(t,i,i,N,C) << endl;
    ans = max(ans,rec(t,i,i,N,C));
  }
  cout << sum - ans << endl;
  return 0;
}


int main(){
  int N, INF = 1000000000;
  cin >> N;
  vector< vector<int> > G(N,vector<int>(N));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j) cin >> G[i][j];
  }
  int ans = INF;
  for(int s = 0; s < N; ++s){
    int t = 0, m, v = s;
    vector<bool> connected(N,false);
    connected[s] = true;
    for(int j = 1; j < N; ++j){
      m = INF;
      for(int i = 0; i < N; ++i){
        if(!connected[i] && G[s][i] < m){
          m = G[v][i];
          v = i;
        }
      }
      t += m;
      connected[v] = true;
    }
    t += min(G[s][v],G[v][s]);
    ans = min(t,ans);
  }
  cout << ans << endl;
  return 0;
}
*/

int main(){
  int N, INF = 1000000000;
  cin >> N;
  vector< vector<int> > G(N,vector<int>(N));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j) cin >> G[i][j];
  }
  long long int ans = 0;
  for(int i = 0; i < N; ++i){
    for(int j = i+1; j < N; ++j){
      ans += min(G[i][j],G[j][i]);
    }
  }
  cout << ans << endl;
  return 0;
}