#include <bits/stdc++.h>   #pragma GCC optimize( Ofast,unroll-loops,no-stack-protector )   using namespace std;   int n, k, nrr = 1, t[502 * 1005];   string s;   struct point {     double x, y;     int ind;     point() {}     point(const point& a) {       x = a.x, y = a.y;       ind = a.ind;     }     point(double _x, double _y) {       x = _x;       y = _y;     }     point& operator-(point& a) {       point* r = new point(*this);       r->x -= a.x, r->y -= a.y;       return *r;     }     point& operator+(point& a) {       point* r = new point(*this);       r->x += a.x, r->y += a.y;       return *r;     }     point& operator*(double val) {       point* r = new point(*this);       r->x *= val, r->y *= val;       return *r;     }     point& operator/(double val) {       point* r = new point(*this);       r->x /= val, r->y /= val;       return *r;     }     bool operator<(const point& a) const {       if (fabs(x - a.x) < 1e-9) {         if (fabs(y - a.y) < 1e-9) return false;         return y < a.y;       }       return x < a.x;     }     bool operator==(const point& a) const {       if (fabs(x - a.x) < 1e-9)         if (fabs(y - a.y) < 1e-9) return true;       return false;     }   };   template <class T>   ostream& operator<<(ostream& out, vector<T> v) {     out << v.size() <<   n ;     for (auto e : v) out << e <<    ;     return out;   }   ostream& operator<<(ostream& out, point p) { return out << p.x <<     << p.y; }   double dx[] = {1, -1, -1, 1};   double dy[] = {1, -1, 1, -1};   long double dist(point a, point b) {     long double X = a.x - b.x;     long double Y = a.y - b.y;     return sqrt(X * X + Y * Y);   }   struct circle {     point o;     double r;     circle() {}     bool operator==(circle& c) {       if (fabs(c.r - r) > 1e-9) return false;       if (fabs(c.o.x - o.x) > 1e-9) return false;       if (fabs(c.o.y - o.y) > 1e-9) return false;       return true;     }     vector<point> intersect(circle c) {       long double p, h, a, area, d;       d = dist(o, c.o);       if (d > r + c.r) return {};       if (d < fabs(r - c.r)) return {};       a = 0.5 * (d + (r * r - c.r * c.r) / d);       h = sqrt(r * r - a * a);       point B = o + (c.o - o) * a / d;       point aa = c.o - o;       point ff(-aa.y, aa.x);       aa = ff * h / d;       return {B + aa, B - aa};     }   };   struct seg {     point a, b;   };   istream& operator>>(istream& in, point& p) { return in >> p.x >> p.y; }   istream& operator>>(istream& in, circle& c) { return in >> c.o >> c.r; }   istream& operator>>(istream& in, seg& s) { return in >> s.a >> s.b; }   long double area(point a, point b, point c) {     return a.x * b.y + b.x * c.y + c.x * a.y - a.y * b.x - b.y * c.x - c.y * a.x;     return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);   }   circle c[550];   bool use[502 * 1000];   int C, V, E;   point pts[500 * 1000];   int sz = 0;   int get_p(point p) {     pts[++sz] = p;     pts[sz].ind = sz;   }   void dfs2(int k) {     use[k] = 1;     if (k == t[k]) C++;     if (!use[t[k]]) dfs2(t[k]);   }   inline int par(int k) {     if (k == t[k]) return k;     return t[k] = par(t[k]);   }   set<point> inters;   void unite(int i, int j) { t[par(i)] = par(j); }   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 0; i <= 502 * 502; i++) t[i] = i;     for (int i = 1; i <= n; i++) cin >> c[i];     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) {         if (c[i] == c[j]) swap(c[j], c[n]), n--, j--;       }     for (int i = 1; i <= n; i++) {       inters.clear();       for (int j = 1; j <= n; j++) {         if (i == j) continue;         auto in = c[i].intersect(c[j]);         for (auto p : in) {           inters.insert(p);         }       }       int init;       for (auto i : inters) {         sz++;         pts[sz] = i;         pts[sz].ind = sz;         if (!(i == *inters.begin()))           unite(sz, init);         else           init = sz;       }       E += inters.size();       if (inters.size() == 0) C++;     }     V = sz;     int u = 0;     for (int i = 1; i <= sz; i++) pts[i].ind = i;     sort(pts + 1, pts + sz + 1);     for (int i = 1; i <= sz; i++, u++) {       int j = i + 1;       while (j <= sz && pts[i] == pts[j]) {         unite(pts[i].ind, pts[j].ind);         j++;       }       i = j - 1;     }     for (int i = 1; i <= V; i++)       if (t[i] == i) C++;     V = u;     cerr <<  V               :            << V <<   n ;     cerr <<  E               :            << E <<   n ;     cout << E - V + C + 1 <<   n ;   }