#include <bits/stdc++.h>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;

typedef pair<int, int> Point;

double dist(const Point &p1, const Point &p2) {
    return sqrt(pow(p1.first - p2.first, 2.0) + pow(p1.second - p2.second, 2.0));
}

double bitonic_tsp_distance(const vector<Point> &p) {
    const int N = p.size();
    vector<vector<double> > L(N, vector<double>(N, 0.0));

    for (int j = 1; j < N; j++) {
        for (int i = 0; i < j; i++) {
            if (i == 0 && j == 1) {
                L[i][j] = dist(p[i], p[j]);
            } else if (i < j - 1) {
                L[i][j] = L[i][j - 1] + dist(p[j - 1], p[j]);
            } else {
                L[i][j] = numeric_limits<double>::infinity();
                for (int k = 0; k < i; k++)
                    L[i][j] = min(L[i][j], L[k][i] + dist(p[k], p[j]));
            }
        }
    }

    double ans = numeric_limits<double>::infinity();

    for (int k = 0; k < N - 1; k++)
        ans = min(ans, L[k][N - 1] + dist(p[k], p[N - 1]));

    return ans;
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > points;

    rep(i, n) {
        int x, y;
        cin >> x >> y;
        points.emplace_back(x, y);
    }
    double ans = bitonic_tsp_distance(points);

    printf("%.20f\n", ans);

}



