// AOJ DPL_2_C Bitonic Traveling Salesman Problem
// 2018.5.9 bal4u

#include <stdio.h>
#include <string.h>
#include <math.h>

#if 0
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in()
{
	int n = 0, c = gc();
	if (c == '-') { c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define INF    1e12
#define MAX_N  1002

typedef struct { int x, y; } PP;
PP p[MAX_N];
double d[MAX_N][MAX_N];

double dist(PP p1, PP p2) { return hypot(p1.x - p2.x, p1.y - p2.y); }

double bitonic_tsp(int n, PP *p)
{
	int i, j, k;
	double t, ans;

	for (j = 1; j < n; j++) {
		for (i = 0; i < j; i++) {
			if (i == 0 && j == 1) d[i][j] = dist(p[i], p[j]);
			else if (i < j - 1) d[i][j] = d[i][j-1] + dist(p[j-1], p[j]);
			else {
				d[i][j] = INF;
				for (k = 0; k < i; k++) {
					t = d[k][i] + dist(p[k], p[j]);
					if (t < d[i][j]) d[i][j] = t;
				}
			}
		}
	}

	ans = INF;
	for (i = k-1; i >= 0; i--) {
		t = d[i][n-1] + dist(p[i], p[n-1]);
		if (t < ans) ans = t;
	}
	return ans;
}

int main()
{
	int N, i;

	N = in();
	for (i = 0; i < N; i++) p[i].x = in(), p[i].y = in();
	printf("%.10lf\n", bitonic_tsp(N, p));
	return 0;
}
