#include <bits/stdc++.h>
using namespace std;
int sig(double x) { return (x > 1e-8) - (x < -1e-8); }
struct P {
  double x, y;
  P(double a = 0, double b = 0) : x(a), y(b) {}
  P operator+(const P &a) const { return P(x + a.x, y + a.y); }
  P operator-(const P &a) const { return P(x - a.x, y - a.y); }
  P operator*(const double a) const { return P(x * a, y * a); }
  double operator*(const P &a) const { return x * a.x + y * a.y; }
  double operator^(const P &a) const { return x * a.y - y * a.x; }
};
P p[220][3];
double dis(P a, P b) { return sqrt((b - a) * (b - a)); }
int inpoly(P a, int k) {
  double ans = 0;
  for (int i = 0; i < 3; i++) {
    P b = p[k][i], c = p[k][(i + 1) % 3];
    ans += fabs(((b - a) ^ (c - a)));
  }
  return sig(ans - fabs((p[k][2] - p[k][0]) ^ (p[k][1] - p[k][0]))) == 0;
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < 3; j++) scanf("%lf%lf", &p[i][j].x, &p[i][j].y);
    double ans = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 3; j++) {
        P A = p[i][j], B = p[i][(j + 1) % 3];
        vector<double> v;
        v.push_back(0.0);
        v.push_back(1.0);
        for (int k1 = 0; k1 < n; k1++) {
          for (int k2 = 0; k2 < 3; k2++) {
            P C = p[k1][k2], D = p[k1][(k2 + 1) % 3];
            double s1 = ((D - C) ^ (A - C)), s2 = ((D - C) ^ (B - C));
            if (sig(s1) * sig(s2) < 0) v.push_back(s1 / (s1 - s2));
          }
        }
        sort(v.begin(), v.end());
        int cnt = v.size();
        for (int k1 = 0; k1 < cnt - 1; k1++) {
          double l = v[k1], r = v[k1 + 1];
          double m = (l + r) / 2.0;
          P mid = A + (B - A) * m;
          int flag = 0;
          for (int k2 = 0; k2 < n; k2++) {
            if (k2 == i) continue;
            if (inpoly(mid, k2)) {
              flag = 1;
              break;
            }
          }
          if (!flag) ans += (r - l) * dis(A, B);
        }
      }
    }
    printf("%.10lf\n", ans);
  }
  return 0;
}
