#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
int n;
struct point {
  double x, y;
  void read() { scanf("%lf%lf", &x, &y); }
  point to(point p) {
    point res;
    res.x = p.x - x;
    res.y = p.y - y;
    return res;
  }
  double cross(point p) { return x * p.y - y * p.x; }
  friend bool operator<(const point &a, const point &b) { return false; }
};
point p[105][3];
struct line {
  double a, b, c;
  line(point u, point v) {
    a = u.y - v.y;
    b = v.x - u.x;
    c = -(u.x * a + u.y * b);
  }
  double at(point t) { return a * t.x + b * t.y + c; }
  bool f(point p) { return abs(at(p)) < 1e-9 * sqrt(a * a + b * b); }
};
bool isect(point a, point b, point c, point d, point &res) {
  line u(a, b);
  if (u.at(c) * u.at(d) >= 0) return false;
  line v(c, d);
  if (v.at(a) * v.at(b) >= 0) return false;
  double det = u.a * v.b - u.b * v.a;
  res.x = (u.b * v.c - u.c * v.b) / det;
  res.y = (u.c * v.a - u.a * v.c) / det;
  return true;
}
inline double sqr(double x) { return x * x; }
double dist(point a, point b) { return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)); }
point middle(point a, point b) {
  point res;
  res.x = (a.x + b.x) / 2;
  res.y = (a.y + b.y) / 2;
  return res;
}
inline double area(point a, point b, point c) {
  return abs(a.to(b).cross(a.to(c))) / 2;
}
bool strict_inside(point a, point b, point c, point d) {
  double s1 = area(a, b, c);
  double s2 = area(a, b, d) + area(a, c, d) + area(b, c, d);
  if (abs(s1 - s2) > 1e-9 * s1) return false;
  line x(a, b);
  if (x.f(d)) return false;
  line y(a, c);
  if (y.f(d)) return false;
  line z(b, c);
  if (z.f(d)) return false;
  return true;
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) p[i][j].read();
  double res = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) {
      point a = p[i][j];
      point b = p[i][(j + 1) % 3];
      vector<pair<double, point> > v;
      for (int i1 = 0; i1 < n; i1++)
        for (int j1 = 0; j1 < 3; j1++) {
          point a1 = p[i1][j1];
          point b1 = p[i1][(j1 + 1) % 3];
          point q;
          if (isect(a, b, a1, b1, q)) v.push_back(make_pair(dist(a, q), q));
        }
      v.push_back(make_pair(dist(a, b), b));
      v.push_back(make_pair(0, a));
      sort(v.begin(), v.end());
      for (int i = 0; i + 1 < v.size(); i++)
        if (v[i + 1].first > v[i].first + 1e-9) {
          point mid = middle(v[i].second, v[i + 1].second);
          bool ok = true;
          for (int j = 0; j < n; j++)
            if (strict_inside(p[j][0], p[j][1], p[j][2], mid)) ok = false;
          if (ok) res += dist(v[i].second, v[i + 1].second);
        }
    }
  printf("%.8lf", res);
}
int main() {
  solve();
  return 0;
}
