#include <bits/stdc++.h>
using namespace std;
using DB = double;
const DB EPS = 1e-8;
struct PT {
  DB x, y;
  PT(DB x = 0, DB y = 0) : x(x), y(y) {}
  void in() { scanf("%lf%lf", &x, &y); }
  DB dis() { return sqrt(x * x + y * y); }
  bool operator<(const PT &p) const {
    if (fabs(x - p.x) < EPS) return y + EPS < p.y;
    return x < p.x;
  }
  bool operator==(const PT &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(const DB &d) const { return PT(x * d, y * d); }
  PT operator/(const DB &d) const { return PT(x / d, y / d); }
};
DB vect(PT p, PT q) { return p.x * q.y - p.y * q.x; }
DB vect(PT p, PT p1, PT p2) { return vect(p1 - p, p2 - p); }
bool onLine(PT p, PT p1, PT p2) { return fabs(vect(p1 - p, p2 - p)) < EPS; }
bool onSeg(PT p, PT p1, PT p2) {
  if (!onLine(p, p1, p2)) return 0;
  return (p1.x - p.x) * (p2.x - p.x) < EPS && (p1.y - p.y) * (p2.y - p.y) < EPS;
}
int posLineLine(PT p1, PT p2, PT p3, PT p4, PT &p) {
  DB s1 = vect(p1, p2, p3), s2 = vect(p1, p2, p4);
  if (fabs(s1 - s2) < EPS) {
    if (fabs(s1) < EPS) return 2;
    return 0;
  }
  p = p3 + (p4 - p3) * s1 / (s1 - s2);
  return 1;
}
int inPolygon(PT p, PT *q, int m) {
  PT p1, p2;
  int k = 0;
  for (int i = 0; i < m; i++) {
    p1 = q[i], p2 = q[(i + 1) % m];
    if (onSeg(p, p1, p2)) return 2;
    if (p1.y > p2.y) swap(p1, p2);
    if (p1.y < p.y + EPS && p.y + EPS < p2.y && vect(p, p1, p2) > 0) k++;
  }
  return k % 2;
}
PT P[111][3];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) P[i][j].in();
  DB ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      PT A = P[i][j], B = P[i][(j + 1) % 3];
      vector<PT> vec;
      vec.push_back(A);
      vec.push_back(B);
      for (int k = 0; k < n; k++) {
        for (int l = 0; l < 3; l++) {
          PT C = P[k][l], D = P[k][(l + 1) % 3];
          PT res;
          int ret = posLineLine(A, B, C, D, res);
          if (ret == 1 && onSeg(res, A, B) && onSeg(res, C, D)) {
            vec.push_back(res);
          }
        }
      }
      sort(vec.begin(), vec.end());
      vec.erase(unique(vec.begin(), vec.end()), vec.end());
      for (int k = 0; k < vec.size() - 1; k++) {
        PT M = (vec[k] + vec[k + 1]) / 2;
        int flg = 0;
        for (int l = 0; l < n; l++) {
          if (l == i) continue;
          if (inPolygon(M, P[l], 3)) {
            flg = 1;
            break;
          }
        }
        if (!flg) ans += (vec[k] - vec[k + 1]).dis();
      }
    }
  }
  printf("%.10lf\n", ans);
  return 0;
}
