#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
constexpr double EPSILON = 1e-6;
struct Point {
	double x, y;
	double distance(const Point& that) const;
};
struct Vector {
	double x, y;
	Vector rotate_clockwise(const struct Angle& angle) const;
	double dot(const Vector& that) const;
	double length() const;
	Vector change_length(const double new_length) const;
};
struct Circle {
	Point center;
	double radius;
};
struct Angle {
	double sin, cos;
	static Angle from_sin(const double sin);
	static Angle from_cos(const double cos);
	static Angle angle90;
	Angle operator-() const;
};
class Line {
	double a, b, c;
	Line(const double _a, const double _b, const double _c);
public:
	Line(const Point& ap, const Point& bp);
	Line(const Point& p, const Vector& v);
	double distance(const Point& p) const;
	std::vector<Point> cross_points(const Circle& c) const;
	Point cross_point(const Line& that) const;
	Line orthogonal(const Point& origin) const;
};
class Ray {
	Point emitter;
	Vector vector;
	Line line;
public:
	Ray(const Point& _emitter, const Vector& _vector);
	Ray(const Point& from, const Point& to);
	bool is_hit(const Circle& that) const;
};

inline bool approx_equals(const double &a, const double &b) {
	return std::abs(a - b) < EPSILON;
}
Vector operator-(const Point& to, const Point& from);
Point operator+(const Vector& vec, const Point& point);
Point operator+(const Point& point, const Vector& vec);
Vector operator*(const Vector& vec, const double scale);
Vector operator*(const double scale, const Vector& vec);
Angle operator+(const Angle& a, const Angle& b);
Angle operator-(const Angle& a, const Angle& b);
std::vector<Line> tangents(const Circle& a, const Circle& b);

int main() {
	int n; std::cin >> n;
	std::vector<Circle> circles(n); for (auto& c : circles) std::cin >> c.center.x >> c.center.y >> c.radius;
	std::vector<int> patterns;
	for (auto i = 1; i < n; ++i) {
		for (auto tangent : tangents(circles[0], circles[i])) {
			auto emitter = tangent.cross_points(circles[0]).front();
			Ray ray(emitter, tangent.cross_points(circles[i]).front());
			int pattern = 1 << (i - 1);
			assert(ray.is_hit(circles[i]));
			for (auto j = 1; j < n; ++j) if (i != j) {
				if (ray.is_hit(circles[j])) {
					pattern |= 1 << (j - 1);
				}
			}
			patterns.push_back(pattern);
		}
		for (auto j = 1; j < i; ++j) {
			for (auto tangent : tangents(circles[i], circles[j])) {
				auto cross_points = tangent.cross_points(circles[0]);
				if (cross_points.empty()) continue;
				auto emitter = cross_points.front();
				auto i_cp = tangent.cross_points(circles[i]).front();
				auto j_cp = tangent.cross_points(circles[j]).front();
				if ((i_cp - emitter).dot(j_cp - emitter) >= 0) {
					Ray ray(emitter, i_cp - emitter);
					assert(ray.is_hit(circles[i]));
					assert(ray.is_hit(circles[j]));
					int pattern = (1 << (i - 1)) | (1 << (j - 1));
					for (auto k = 1; k < n; ++k) if (k != i && k != j) {
						if (ray.is_hit(circles[k])) {
							pattern |= 1 << (k - 1);
						}
					}
					patterns.push_back(pattern);
				}
			}
		}
	}
	std::sort(patterns.begin(), patterns.end());
	patterns.erase(std::unique(patterns.begin(), patterns.end()), patterns.end());
	std::vector<int> min_count(1 << (n - 1), INT_MAX); min_count[0] = 0;
	std::queue<int> queue; queue.push(0);
	while (!queue.empty() && min_count.back() == INT_MAX) {
		auto top = queue.front(); queue.pop();
		for (const auto p : patterns) {
			if (min_count[top | p] > min_count[top] + 1) {
				min_count[top | p] = min_count[top] + 1;
				queue.push(top | p);
			}
		}
	}
	std::cout << min_count.back() << '\n';
}

std::vector<Line> tangents(const Circle& a, const Circle& b)
{
	std::vector<Line> result;
	const auto base_vec = a.center - b.center;
	const auto narrow_angle = Angle::from_sin((a.radius - b.radius) / a.center.distance(b.center));
	result.emplace_back(base_vec.rotate_clockwise(narrow_angle + Angle::angle90).change_length(a.radius) + a.center, base_vec.rotate_clockwise(narrow_angle + Angle::angle90).change_length(b.radius) + b.center);
	result.emplace_back(base_vec.rotate_clockwise(-narrow_angle - Angle::angle90).change_length(a.radius) + a.center, base_vec.rotate_clockwise(-narrow_angle - Angle::angle90).change_length(b.radius) + b.center);
	const auto mid_point = base_vec.change_length(b.radius / (a.radius + b.radius) * a.center.distance(b.center)) + b.center;
	const auto wide_angle = Angle::from_sin((a.radius + b.radius) / a.center.distance(b.center));
	result.emplace_back(base_vec.rotate_clockwise(wide_angle) + mid_point, mid_point);
	result.emplace_back(base_vec.rotate_clockwise(-wide_angle) + mid_point, mid_point);
	return result;
}

Line::Line(const double _a, const double _b, const double _c) : a{ _a }, b{ _b }, c{ _c }{}

Line::Line(const Point& ap, const Point& bp) : a{ ap.y - bp.y }, b{ bp.x - ap.x }, c{ ap.x * bp.y - ap.y * bp.x }{}

Line::Line(const Point& p, const Vector& v) : a{ v.y }, b{ -v.x }, c{ v.x * p.y - v.y * p.x }{}

double Line::distance(const Point& p) const
{
	return std::abs(a * p.x + b * p.y + c) / std::sqrt(a * a + b * b);
}

std::vector<Point> Line::cross_points(const Circle& c) const
{
	std::vector<Point> result;
	const auto dist = distance(c.center);
	if (dist > c.radius + EPSILON) return result;
	if (approx_equals(dist, c.radius)) {
		result.push_back(cross_point(orthogonal(c.center)));
		return result;
	}
	const auto cp = cross_point(orthogonal(c.center));
	const auto angle = Angle::from_cos(dist / c.radius);
	result.push_back((cp - c.center).rotate_clockwise(angle).change_length(c.radius) + c.center);
	result.push_back((cp - c.center).rotate_clockwise(-angle).change_length(c.radius) + c.center);
	return result;
}

Point Line::cross_point(const Line& that) const
{
	assert(!approx_equals(a * that.b - b * that.a, 0));
	auto d = a * that.b - b * that.a;
	return Point{ (b * that.c - c * that.b) / d, (c * that.a - a * that.c) / d };
}

Line Line::orthogonal(const Point& origin) const
{
	return Line(-b, a, b * origin.x - a * origin.y);
}

Ray::Ray(const Point& _emitter, const Vector& _vector) : emitter{ _emitter }, vector{ _vector }, line(_emitter, _vector){}

Ray::Ray(const Point& from, const Point& to) : emitter{ from }, vector{ to - from }, line(from, to){}

bool Ray::is_hit(const Circle& that) const
{
	const auto cross_points = line.cross_points(that);
	return !cross_points.empty() && (cross_points.front() - emitter).dot(vector) >= 0;
}
Angle Angle::angle90{ 1.0, 0.0 };

Angle Angle::from_sin(const double sin)
{
	return Angle{ sin, std::sqrt(1 - sin * sin) };
}

Angle Angle::from_cos(const double cos)
{
	return Angle{ std::sqrt(1 - cos * cos), cos };
}

Angle Angle::operator-() const
{
	return Angle{ -sin, cos };
}

Vector operator-(const Point& to, const Point& from)
{
	return Vector{ to.x - from.x, to.y - from.y };
}

Point operator+(const Vector& vec, const Point& point)
{
	return Point{ vec.x + point.x, vec.y + point.y };
}

Point operator+(const Point& point, const Vector& vec)
{
	return Point{ point.x + vec.x, point.y + vec.y };
}

Vector operator*(const Vector& vec, const double scale)
{
	return Vector{ vec.x * scale, vec.y * scale };
}

Vector operator*(const double scale, const Vector& vec)
{
	return Vector{ scale * vec.x, scale * vec.y };
}

Angle operator+(const Angle& a, const Angle& b)
{
	return Angle{ a.sin * b.cos + a.cos * b.sin, a.cos * b.cos - a.sin * b.sin };
}

Angle operator-(const Angle& a, const Angle& b)
{
	return Angle{ a.sin * b.cos - a.cos * b.sin, a.cos * b.cos + a.sin * b.sin };
}

Vector Vector::rotate_clockwise(const Angle& angle) const
{
	return Vector{ angle.cos * x - angle.sin * y, angle.cos * y + angle.sin * x };
}

double Vector::dot(const Vector& that) const
{
	return x * that.x + y * that.y;
}

double Vector::length() const
{
	return std::sqrt(x * x + y * y);
}

Vector Vector::change_length(const double new_length) const
{
	return (*this) * (new_length / length());
}

double Point::distance(const Point& that) const
{
	return (*this - that).length();
}




Measured memory_bytes: 3300