#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 1005

struct Point{
	double x,y;
};

int N;
double dist_table[NUM][NUM],dp[NUM][NUM];
Point point[NUM];


double calc_dist(Point A,Point B){

	return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}

int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){

		scanf("%lf %lf",&point[i].x,&point[i].y);
	}

	for(int i = 0; i < N-1; i++){
		for(int k = i+1; k < N; k++){

			dist_table[i][k] = calc_dist(point[i],point[k]);
			dist_table[k][i] = dist_table[i][k];
		}
	}

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){

			dp[i][k] = 0;
		}
	}

	for(int to = 1; to <= N-1; to++){
		for(int from = 0; from < to; from++){

			if(from == 0 && to == 1){

				dp[from][to] = dist_table[from][to];

			}else if(from < to-1){

				dp[from][to] = dp[from][to-1]+dist_table[to-1][to];

			}else{

				dp[from][to] = BIG_NUM;

				for(int k = 0; k < from; k++){

					dp[from][to] = min(dp[from][to],dp[k][from]+dist_table[k][to]);
				}
			}
		}
	}

	double ans = BIG_NUM;

	for(int i = 0; i <= N-2; i++){

		ans = min(ans,dp[i][N-1]+dist_table[i][N-1]);
	}

	printf("%.10lf\n",ans);

	return 0;
}


