#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

double dist[1100][1100];
double DP[1100][1100];

int main(){
	
	int N;
	cin >> N;
	
	double x[1100], y[1100];
	for(int i = 0; i < N; i++){
		cin >> x[i] >> y[i];
	}
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			double dx = x[j] - x[i];
			double dy = y[j] - y[i];
			dist[i][j] = sqrt(dx * dx + dy * dy);
		}
	}
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			DP[i][j] = INF;
		}
	}
	
	DP[0][0] = 0;
	for(int i = 0; i < N; i++){
		for(int j = 0; j <= i; j++){
			DP[i][i + 1] = min(DP[i][i + 1], DP[j][i] + dist[j][i + 1]);
		}
		for(int j = i + 2; j < N; j++){
			DP[i][j] = DP[i][j - 1] + dist[j - 1][j];
		}
	}
	double ans = INF;
	for(int i = 0; i < N; i++){
		ans = min(ans, DP[i][N - 1] + dist[i][N - 1]);
	}
	
	printf("%.8f\n", ans);
	
	return 0;
}
