#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
    string sep = " ";
    if(v.size()) os << v[0];
    for(int i=1; i<v.size(); i++) os << sep << v[i];
    return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
    for(int i=0; i<v.size(); i++) is >> v[i];
    return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
    cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;

    ll ans = 0;
    for(int i=0; i<n; i++){
        if(a[i]>10) ans += a[i]-10;
    }
    cout << ans << endl;
    return 0;
}
# include <ciso646>
# include <cstdio>
# include <algorithm>

namespace Main {
    namespace Source {
        typedef signed int dint;
        typedef unsigned int uint;
        static inline const uint abs(const dint x) { return x < 0 ? -x : x; }
        static inline const uint max(const uint a, const uint b) { return a < b ? b : a; }
    }
    using namespace Source;
    enum { N = (const uint)2e5 };
    struct house {
        dint x, y;
        uint id;
        inline const void read(const uint id) { scanf("%d%d", &x, &y), this->id = id; }
        friend inline const uint operator xor (const house& a, const house& b)
        { return max(abs(a.x - b.x), abs(a.y - b.y)); }
        friend inline const bool operator < (const house& a, const house& b) { return a.id < b.id; }
        friend inline const bool cmpx(const house& a, const house& b) { return a.x < b.x; }
        friend inline const bool cmpy(const house& a, const house& b) { return a.y < b.y; }
    };
    static uint n;
    static house h[N + 1];
    static uint mx, my, mi, mj;
    static uint mmx, mmy;
    extern inline const bool cmpx(const house& a, const house& b);
    extern inline const bool cmpy(const house& a, const house& b);
    static inline const bool eq(const uint a, const uint b, const uint c, const uint d)
    { return a == c && b == d or a == d && b == c; }
    static inline const void main() {
        scanf("%u", &n);
        for (register uint i(1); i <= n; ++i) h[i].read(i);
        std::sort(&h[1], &h[n] + 1, cmpx), mx = h[n].x - h[1].x;
        std::sort(&h[1], &h[n] + 1, cmpy), my = h[n].y - h[1].y;
        if (mx >= my) {
            std::sort(&h[1], &h[n] + 1, cmpx), mi = h[1].id, mj = h[n].id;
            mmx = max(h[n - 1].x - h[1].x, h[n].x - h[2].x);
            std::sort(&h[1], &h[n] + 1, cmpy);
            mmy = eq(h[1].id, h[n].id, mi, mj) ? max(h[n - 1].y - h[1].y, h[n].y - h[2].y) : my;
        }
        else {
            std::sort(&h[1], &h[n] + 1, cmpy), mi = h[1].id, mj = h[n].id;
            mmy = max(h[n - 1].y - h[1].y, h[n].y - h[2].y);
            std::sort(&h[1], &h[n] + 1, cmpx);
            mmx = eq(h[1].id, h[n].id, mi, mj) ? max(h[n - 1].x - h[1].x, h[n].x - h[2].x) : mx;
        }
        printf("%u\n", max(mmx, mmy));
    }
}

signed int main() { Main::main(); return 0; }