#include <bits/stdc++.h>
using namespace std;
int a[2001][2001];
int n, z;
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
    }
    if (a[i][i]) z = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i][j] != a[j][i] || (a[i][j] == 0 && j != i)) {
        z = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    int r = 1;
    for (int j = 0; j < n; j++) {
      if (a[i][j] < a[i][r] && i != j) {
        r = j;
      }
    }
    for (int k = 0; k < n; k++) {
      if (abs(a[i][k] - a[r][k]) != a[r][i]) {
        z = 1;
      }
    }
  }
  if (!z)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
