#include <bits/stdc++.h>
using namespace std;
int N;
struct point {
  double x, y;
};
point P[110][3];
double dist(point P, point Q) {
  double dx = P.x - Q.x, dy = P.y - Q.y;
  return sqrt(dx * dx + dy * dy);
}
double area(point P, point Q, point R) {
  return ((Q.x - P.x) * (R.y - P.y) - (Q.y - P.y) * (R.x - P.x)) / 2.0;
}
bool inside(point Q, int id) {
  double tmp =
      ((area(P[id][0], P[id][1], Q)) > 0.0 ? (area(P[id][0], P[id][1], Q))
                                           : -(area(P[id][0], P[id][1], Q))) +
      ((area(P[id][1], P[id][2], Q)) > 0.0 ? (area(P[id][1], P[id][2], Q))
                                           : -(area(P[id][1], P[id][2], Q))) +
      ((area(P[id][2], P[id][0], Q)) > 0.0 ? (area(P[id][2], P[id][0], Q))
                                           : -(area(P[id][2], P[id][0], Q))) -
      ((area(P[id][0], P[id][1], P[id][2])) > 0.0
           ? (area(P[id][0], P[id][1], P[id][2]))
           : -(area(P[id][0], P[id][1], P[id][2])));
  return (tmp > -1.0E-8 && tmp < 1.0E-8);
}
void printPoint(point A) { printf("x:%.2lf y:%.2lf\n", A.x, A.y); }
int main(void) {
  int i, j, k, l;
  cin >> N;
  for ((i) = 0; (i) < (int)(N); (i)++)
    cin >> P[i][0].x >> P[i][0].y >> P[i][1].x >> P[i][1].y >> P[i][2].x >>
        P[i][2].y;
  double ans = 0.0;
  for ((i) = 0; (i) < (int)(N); (i)++)
    for ((j) = 0; (j) < (int)(3); (j)++) {
      point A = P[i][j], B = P[i][(j + 1) % 3];
      vector<double> v;
      v.push_back(0.0);
      v.push_back(1.0);
      for ((k) = 0; (k) < (int)(N); (k)++)
        for ((l) = 0; (l) < (int)(3); (l)++) {
          point C = P[k][l], D = P[k][(l + 1) % 3];
          double s1 = area(C, D, A), s2 = area(C, D, B);
          if ((s1 > 0 && s2 < 0) || (s1 < 0 && s2 > 0)) {
            v.push_back(s1 / (s1 - s2));
          }
        }
      sort(v.begin(), v.end());
      double d = dist(A, B);
      for ((k) = 0; (k) < (int)(v.size() - 1); (k)++) {
        double t = (v[k] + v[k + 1]) / 2.0;
        point Q = {A.x + (B.x - A.x) * t, A.y + (B.y - A.y) * t};
        bool black = false;
        for ((l) = 0; (l) < (int)(N); (l)++)
          if (l != i && inside(Q, l)) {
            black = true;
            break;
          }
        if (!black) {
          ans += d * (v[k + 1] - v[k]);
        }
      }
      v.clear();
    }
  printf("%.12f\n", ans);
  return 0;
}
