#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point to(const Point &p) const { return Point(p.x - x, p.y - y); }
  double dot(const Point &p) const { return p.x * x + p.y * y; }
  double cross(const Point &p) const { return x * p.y - y * p.x; }
  double len2() const { return x * x + y * y; }
  double len() const { return sqrt(len2()); }
  friend Point operator+(const Point &a, const Point &b) {
    return Point(a.x + b.x, a.y + b.y);
  }
  friend Point operator-(const Point &a, const Point &b) {
    return Point(a.x - b.x, a.y - b.y);
  }
  friend Point operator*(double k, const Point &p) {
    return Point(p.x * k, p.y * k);
  }
  friend Point operator*(const Point &p, double k) {
    return Point(p.x * k, p.y * k);
  }
  friend bool operator<(const Point &u, const Point &v) { return false; }
};
struct Line {
  double a, b, c;
  Line(double a, double b, double c) : a(a), b(b), c(c) {}
  static Line PP(const Point &u, const Point &v) {
    double a = u.y - v.y, b = v.x - u.x;
    return Line(a, b, -(a * u.x + b * u.y));
  }
  static Line PN(const Point &p, const Point &n) {
    return Line(n.x, n.y, -(n.x * p.x + n.y * p.y));
  }
  double at(const Point &p) const { return a * p.x + b * p.y + c; }
  double sigdist(const Point &p) const { return at(p) / sqrt(a * a + b * b); }
  Point isect(const Line &other) {
    double d = a * other.b - b * other.a;
    return Point((b * other.c - c * other.b) / d,
                 (c * other.a - a * other.c) / d);
  }
};
bool seg_strict_isect(const Point &a, const Point &b, const Point &c,
                      const Point &d, Point &x) {
  Line u = Line::PP(a, b);
  if (u.at(c) * u.at(d) >= 0) return false;
  Line v = Line::PP(c, d);
  if (v.at(a) * v.at(b) >= 0) return false;
  x = u.isect(v);
  return true;
}
inline double area(Point a, Point b, Point c) {
  return abs(a.to(b).cross(a.to(c))) * 0.5;
}
inline bool online(Point a, Point b, Point c) {
  return abs(Line::PP(a, b).sigdist(c)) < 1e-9;
}
bool strict_inside(Point a, Point b, Point c, Point d) {
  double s1 = area(a, b, c);
  double s2 = area(d, a, b) + area(d, b, c) + area(d, a, c);
  if (abs(s1 - s2) > s1 * 1e-9) return false;
  if (online(a, b, d) || online(b, c, d) || online(a, c, d)) return false;
  return true;
}
Point p[105][3];
int n;
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) {
      double x, y;
      scanf("%lf%lf", &x, &y);
      p[i][j] = Point(x, y);
    }
  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;
      v.push_back(make_pair(0, a));
      v.push_back(make_pair(a.to(b).len(), b));
      for (int i1 = 0; i1 < n; i1++)
        for (int j1 = 0; j1 < 3; j1++) {
          Point c = p[i1][j1];
          Point d = p[i1][(j1 + 1) % 3];
          Point x;
          if (seg_strict_isect(a, b, c, d, x)) {
            v.push_back(make_pair(a.to(x).len(), x));
          }
        }
      sort(v.begin(), v.end());
      for (int t = 0; t + 1 < v.size(); t++)
        if (v[t + 1].first - v[t].first > 1e-9) {
          Point m = (v[t].second + v[t + 1].second) * 0.5;
          bool ok = true;
          for (int u = 0; u < n; u++) {
            if (strict_inside(p[u][0], p[u][1], p[u][2], m)) {
              ok = false;
              break;
            }
          }
          if (ok) res += v[t + 1].first - v[t].first;
        }
    }
  printf("%.8lf", res);
}
int main() {
  solve();
  return 0;
}
