#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
template <typename first>
inline first abs(const first& a) {
  return a < 0 ? -a : a;
}
template <typename first>
inline first sqr(const first& a) {
  return a * a;
}
const long double PI = 3.1415926535897932384626433832795;
const int INF = 1000 * 1000 * 1000;
const long double EPS = 1e-9;
struct pt {
  long double x, y;
  pt(long double x = 0.0, long double y = 0.0) : x(x), y(y) {}
};
struct seg {
  pt a, b;
  int idx;
  seg(pt a, pt b, int idx = -1) : a(a), b(b), idx(idx) {}
};
inline bool goodBox(const pt& a, const seg& s) {
  if (a.x + EPS < min(s.a.x, s.b.x) || a.x > max(s.a.x, s.b.x) + EPS)
    return false;
  if (a.y + EPS < min(s.a.y, s.b.y) || a.y > max(s.a.y, s.b.y) + EPS)
    return false;
  return true;
}
inline long double det(const long double& ax, const long double& ay,
                       const long double& bx, const long double& by) {
  return ax * by - ay * bx;
}
inline bool intersect(const seg& s1, const seg& s2, pt& p) {
  long double A1 = s1.b.y - s1.a.y, B1 = s1.a.x - s1.b.x,
              C1 = -(A1 * s1.a.x + B1 * s1.a.y);
  long double A2 = s2.b.y - s2.a.y, B2 = s2.a.x - s2.b.x,
              C2 = -(A2 * s2.a.x + B2 * s2.a.y);
  long double d = det(A1, B1, A2, B2);
  if (abs(d) < EPS) return false;
  long double x = det(-C1, B1, -C2, B2) / d;
  long double y = det(A1, -C1, A2, -C2) / d;
  p = pt(x, y);
  if (!goodBox(p, s1) || !goodBox(p, s2)) return false;
  return true;
}
inline long double dist(const pt& a, const pt& b) {
  return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}
inline long double leng(const seg& s) { return dist(s.a, s.b); }
inline bool cmpLess(const long double& a, const long double& b) {
  return a + EPS < b;
}
inline bool cmpEq(const long double& a, const long double& b) {
  return abs(a - b) < EPS;
}
inline bool cmpY(const seg& s1, const seg& s2) {
  long double mid1 = (s1.a.y + s1.b.y) / 2.0;
  long double mid2 = (s2.a.y + s2.b.y) / 2.0;
  return mid1 + EPS < mid2;
}
inline bool cmpYs(const pair<long double, int>& a,
                  const pair<long double, int>& b) {
  return a.first + EPS < b.first;
}
const int N = 300 + 13;
int n;
vector<long double> xs;
vector<seg> s;
int opened[N];
int main() {
  cin >> n;
  long double alp = 1.23478362834823;
  long double cosa = cos(alp);
  long double sina = sin(alp);
  for (int i = 0; i < int(n); i++) {
    pt p[3];
    for (int j = 0; j < int(3); j++) {
      int ax, ay;
      scanf("%d%d", &ax, &ay);
      p[j] = pt(ax, ay);
      p[j] = pt(p[j].x * cosa + p[j].y * sina, -p[j].x * sina + p[j].y * cosa);
    }
    for (int j = 0; j < int(3); j++) s.push_back(seg(p[j], p[(j + 1) % 3], i));
  }
  for (int i = 0; i < int(int((s).size())); i++) {
    xs.push_back(s[i].a.x);
    xs.push_back(s[i].b.x);
    for (int j = 0; j < int(i); j++) {
      pt p;
      if (!intersect(s[j], s[i], p)) continue;
      xs.push_back(p.x);
    }
  }
  sort((xs).begin(), (xs).end(), cmpLess);
  xs.erase(unique((xs).begin(), (xs).end(), cmpEq), xs.end());
  long double ans = 0.0;
  for (int i = 0; i < int(int((xs).size()) - 1); i++) {
    long double x1 = xs[i], x2 = xs[i + 1];
    seg s1 = seg(pt(x1, -1e6), pt(x1, 1e6));
    seg s2 = seg(pt(x2, -1e6), pt(x2, 1e6));
    vector<seg> ys;
    for (int j = 0; j < int(int((s).size())); j++) {
      seg& cur = s[j];
      if (max(cur.a.x, cur.b.x) < x1 + EPS || min(cur.a.x, cur.b.x) + EPS > x2)
        continue;
      pt p1, p2;
      assert(intersect(s1, cur, p1));
      assert(intersect(s2, cur, p2));
      ys.push_back(seg(p1, p2, s[j].idx));
    }
    sort((ys).begin(), (ys).end(), cmpY);
    int cntOp = 0;
    for (int j = 0; j < int(int((ys).size())); j++) {
      int idx = ys[j].idx;
      if (opened[idx]) {
        cntOp--;
        assert(cntOp >= 0);
        if (cntOp == 0) ans += leng(ys[j]);
      } else {
        assert(cntOp >= 0);
        if (cntOp == 0) ans += leng(ys[j]);
        cntOp++;
      }
      opened[idx] = 1 - opened[idx];
    }
    for (int j = 0; j < int(n); j++) assert(!opened[j]);
  }
  cout << setprecision(10) << fixed;
  cout << ans << endl;
  return 0;
}
