#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
const int mod = 1e9 + 7;
const int shift = 1337;
const int pp = 10007;
int n, x[maxn], y[maxn];
int a[maxn], h[maxn][maxn], sum[maxn][maxn];
int l[maxn], dp[maxn][maxn][maxn][2];
bool side(int x1, int y1, int x2, int y2, int x3, int y3) {
long long ux = x2 - x1;
long long uy = y2 - y1;
long long vx = x3 - x1;
long long vy = y3 - y1;
return ux * vy - uy * vx < 0;
}
int go(int b, int e, int d, bool s) {
if (dp[b][e][d][s] >= 0) {
return dp[b][e][d][s];
} else if (b == 0 || e == 0) {
return -l[b + d];
}
int left = -1e9, right = -1e9;
for (int i = 1; i + e - b < n; i++) {
int l = i, r = i + e - b;
if (h[b][e] == h[l][r]) {
int lcost = go(l - 1, r, d + 1, 0);
int rcost = go(l, (r + 1) % n, d, 1);
if (!s) {
lcost += a[2 * l - 1];
rcost += sum[l][(r + 1) % n];
} else {
lcost += sum[l - 1][r];
rcost += a[2 * r + 1];
}
left = max(lcost, left);
right = max(rcost, right);
}
}
int ret = min(left, right);
for (int i = 1; i + e - b < n; i++) {
int l = i, r = i + e - b;
if (h[b][e] == h[l][r]) {
dp[l][r][d][s] = ret;
}
}
return ret;
}
int main() {
//freopen("lightsout.in", "r", stdin);
//freopen("lightsout.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
}
for (int i = 0; i < n; i++) {
a[2 * i] = side(x[(i + n - 1) % n], y[(i + n - 1) % n],
x[i], y[i],
x[(i + 1) % n], y[(i + 1) % n]);
--a[2 * i];
a[2 * i + 1] = abs(x[i] - x[(i + 1) % n])
+ abs(y[i] - y[(i + 1) % n]);
}
a[0] = -2; //distinct start
for (int b = 0; b < n; b++) {
for (int e = 0; e < n; e++) {
for (int i = 2 * b; ; i = (i + 1) % (2 * n)) {
h[b][e] = (1LL * h[b][e] * pp + a[i] + shift) % mod;
if (a[i] > 0) {
sum[b][e] += a[i];
}
if (i == 2 * e) {
break;
}
}
}
}
for (int i = 0; i < n; i++) {
l[i] = min(sum[0][i], sum[i][0]);
}
fill_n(&dp[0][0][0][0], maxn * maxn * maxn * 2, -1);
int res = 0;
for (int i = 0; i < n; i++) {
if (a[i] == -1) {
res = max(go(i, i, 0, 0), res);
break;
}
}
for (int i = 0; i < n; i++) {
if (a[i] == 0) {
res = max(go(i, i, 0, 0), res);
break;
}
}
cout << res << '\n';
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBtYXhuID0gMjA1Owpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKY29uc3QgaW50IHNoaWZ0ID0gMTMzNzsKY29uc3QgaW50IHBwID0gMTAwMDc7CgppbnQgbiwgeFttYXhuXSwgeVttYXhuXTsKaW50IGFbbWF4bl0sIGhbbWF4bl1bbWF4bl0sIHN1bVttYXhuXVttYXhuXTsKaW50IGxbbWF4bl0sIGRwW21heG5dW21heG5dW21heG5dWzJdOwoKYm9vbCBzaWRlKGludCB4MSwgaW50IHkxLCBpbnQgeDIsIGludCB5MiwgaW50IHgzLCBpbnQgeTMpIHsKICAgIGxvbmcgbG9uZyB1eCA9IHgyIC0geDE7CiAgICBsb25nIGxvbmcgdXkgPSB5MiAtIHkxOwogICAgbG9uZyBsb25nIHZ4ID0geDMgLSB4MTsKICAgIGxvbmcgbG9uZyB2eSA9IHkzIC0geTE7CiAgICByZXR1cm4gdXggKiB2eSAtIHV5ICogdnggPCAwOwp9CgppbnQgZ28oaW50IGIsIGludCBlLCBpbnQgZCwgYm9vbCBzKSB7CiAgICBpZiAoZHBbYl1bZV1bZF1bc10gPj0gMCkgewogICAgICAgIHJldHVybiBkcFtiXVtlXVtkXVtzXTsKICAgIH0gZWxzZSBpZiAoYiA9PSAwIHx8IGUgPT0gMCkgewogICAgICAgIHJldHVybiAtbFtiICsgZF07CiAgICB9CiAgICBpbnQgbGV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jsgaSsrKSB7CiAgICAgICAgY2luID4+IHhbaV0gPj4geVtpXTsKICAgIH0KICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgYVsyICogaV0gPSBzaWRlKHhbKGkgKyBuIC0gMSkgJSBuXSwgeVsoaSArIG4gLSAxKSAlIG5dLAogICAgICAgICAgICAgICAgICAgICAgICB4W2ldLCB5W2ldLAogICAgICAgICAgICAgICAgICAgICAgICB4WyhpICsgMSkgJSBuXSwgeVsoaSArIDEpICUgbl0pOwogICAgICAgIC0tYVsyICogaV07CiAgICAgICAgYVsyICogaSArIDFdID0gYWJzKHhbaV0gLSB4WyhpICsgMSkgJSBuXSkKICAgICAgICArIGFicyh5W2ldIC0geVsoaSArIDEpICUgbl0pOwogICAgfQogICAgYVswXSA9IC0yOyAvL2Rpc3RpbmN0IHN0YXJ0CiAgICBmb3IgKGludCBiID0gMDsgYiA8IG47IGIrKykgewogICAgICAgIGZvciAoaW50IGUgPSAwOyBlIDwgbjsgZSsrKSB7CiAgICAgICAgICAgIGZvciAoaW50IGkgPSAyICogYjsgOyBpID0gKGkgKyAxKSAlICgyICogbikpIHsKICAgICAgICAgICAgICAgIGhbYl1bZV0gPSAoMUxMICogaFtiXVtlXSAqIHBwICsgYVtpXSArIHNoaWZ0KSAlIG1vZDsKICAgICAgICAgICAgICAgIGlmIChhW2ldID4gMCkgewogICAgICAgICAgICAgICAgICAgIHN1bVtiXVtlXSArPSBhW2ldOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGkgPT0gMiAqIGUpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAJbFtpXSA9IG1pbihzdW1bMF1baV0sIHN1bVtpXVswXSk7CiAgICB9CiAgICBmaWxsX24oJmRwWzBdWzBdWzBdWzBdLCBtYXhuICogbWF4biAqIG1heG4gKiAyLCAtMSk7CiAgICBpbnQgcmVzID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAJaWYgKGFbaV0gPT0gLTEpIHsKICAgIAkJcmVzID0gbWF4KGdvKGksIGksIDAsIDApLCByZXMpOwogICAgCQlicmVhazsKICAgIAl9CiAgICB9CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgCWlmIChhW2ldID09IDApIHsKICAgIAkJcmVzID0gbWF4KGdvKGksIGksIDAsIDApLCByZXMpOwogICAgCQlicmVhazsKICAgIAl9CiAgICB9CiAgICBjb3V0IDw8IHJlcyA8PCAnXG4nOwogICAgcmV0dXJuIDA7Cn0K