#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 300 * 1000 + 7;
const long long MOD = 998244353;
const double PI = 2 * acos(0.0);
struct line {
  double x, y, xx, yy;
};
long long n;
line N[MAXN];
double ans = 0, del = 0.0000001;
long long ccw(double a, double aa, double b, double bb, double c, double cc) {
  double m1 = (bb - aa) * (c - b);
  double m2 = (cc - bb) * (b - a);
  if (abs(m2 - m1) < del) return 0;
  if (m2 > m1) return 1;
  return -1;
}
pair<double, double> cross(line a, line b) {
  double a1 = a.yy - a.y;
  double b1 = a.x - a.xx;
  double c1 = a1 * (a.x) + b1 * (a.y);
  double a2 = b.yy - b.y;
  double b2 = b.x - b.xx;
  double c2 = a2 * (b.x) + b2 * (b.y);
  double determinant = a1 * b2 - a2 * b1;
  double X = (b2 * c1 - b1 * c2) / determinant;
  double Y = (a1 * c2 - a2 * c1) / determinant;
  return make_pair(X, Y);
}
int main(void) {
  cin >> n;
  for (long long i0 = 0; i0 < n; i0++) {
    double i, j;
    cin >> i >> j;
    N[(3 * i0)].x = i;
    N[(3 * i0)].y = j;
    N[(3 * i0) + 1].x = i;
    N[(3 * i0) + 1].y = j;
    cin >> i >> j;
    N[(3 * i0)].xx = i;
    N[(3 * i0)].yy = j;
    N[(3 * i0) + 2].x = i;
    N[(3 * i0) + 2].y = j;
    cin >> i >> j;
    N[(3 * i0) + 1].xx = i;
    N[(3 * i0) + 1].yy = j;
    N[(3 * i0) + 2].xx = i;
    N[(3 * i0) + 2].yy = j;
  }
  for (long long i0 = 0; i0 < 3 * n; i0++) {
    double i = N[i0].x, j = N[i0].y, ii = N[i0].xx, jj = N[i0].yy;
    vector<pair<double, double> > kobe;
    kobe.push_back({i, j});
    kobe.push_back({ii, jj});
    for (long long j0 = 0; j0 < 3 * n; j0++) {
      if (i0 == j0) continue;
      long long q = ccw(i, j, ii, jj, N[j0].x, N[j0].y);
      long long w = ccw(i, j, ii, jj, N[j0].xx, N[j0].yy);
      long long e = ccw(N[j0].x, N[j0].y, N[j0].xx, N[j0].yy, i, j);
      long long r = ccw(N[j0].x, N[j0].y, N[j0].xx, N[j0].yy, ii, jj);
      if (!(q == 0 || w == 0 || e == 0 || r == 0) && (q + w == 0) &&
          (e + r == 0)) {
        kobe.push_back(cross(N[i0], N[j0]));
      }
    }
    sort(kobe.begin(), kobe.end());
    long long SIZE = kobe.size();
    for (long long j0 = 0; j0 < SIZE - 1; j0++) {
      i = kobe[j0].first;
      j = kobe[j0].second;
      ii = kobe[j0 + 1].first;
      jj = kobe[j0 + 1].second;
      if (abs(j - i) < del && abs(jj - ii) < del) continue;
      pair<double, double> mid;
      mid.first = i + (ii - i) / 2;
      mid.second = j + (jj - j) / 2;
      bool ok = true;
      for (long long k = 0; k < n; k++) {
        if (k == (i0 / 3)) continue;
        double m, l, mm, ll, mmm, lll;
        m = N[3 * k].x, l = N[3 * k].y;
        mm = N[3 * k].xx, ll = N[3 * k].yy;
        mmm = N[(3 * k) + 1].xx, lll = N[(3 * k) + 1].yy;
        long long q = ccw(m, l, mm, ll, mid.first, mid.second);
        long long w = ccw(mm, ll, mmm, lll, mid.first, mid.second);
        long long e = ccw(mmm, lll, m, l, mid.first, mid.second);
        if (!(q == 0 || w == 0 || e == 0) && (q == w) && (w == e)) {
          ok = false;
          break;
        }
      }
      if (ok) ans += sqrt((ii - i) * (ii - i) + (jj - j) * (jj - j));
    }
  }
  cout << setprecision(10) << fixed << ans << endl;
  return 0;
}
