#include <bits/stdc++.h>

using namespace std;

#define debug(x) cerr << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) { cout << endl; }

template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

template<typename T>
inline void read(T& x) {
    x = 0; T f = 1; char ch = getchar();
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

template<typename T, typename ...Args>
inline void read(T& x, Args&... args) { read(x), read(args...); }

constexpr int MAXN = 1e5 + 5, MOD = 1e9 + 7;

int n;
array<int, MAXN> a, cnt;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        for (int j = 2; j <= a[i]; j++) {
            if (a[i] % j == 0) cnt[j]++;
        }
    }

    int ans = 0, id = 0;
    for (int i = 1; i <= 1000; i++) {
        if (cnt[i] > ans) ans = cnt[i], id = i;
    }
    cout << id << endl;
    return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++ i)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

int N;
pair<double, double> seg[2005];

int main()
{
    cin >> N;
    rep(i, N) {
        int t; cin >> t >> seg[i].first >> seg[i].second;
        if (t == 2) seg[i].second -= 0.1;
        if (t == 3) seg[i].first += 0.1;
        if (t == 4) seg[i].first += 0.1, seg[i].second -= 0.1;
    }

    sort(seg, seg + N, [&](pair<double, double> x, pair<double, double> y){
        if (x.first == y.first) return x.second > y.second;
        return x.first < y.first;
    });

    vector<double> ver;
    rep(i, N) ver.push_back(seg[i].first);

    LL ret = 0;
    rep(i, N) {
        int j = upper_bound(ver.begin() + i, ver.end(), seg[i].second) - ver.begin();
        ret += max(0, (j - i - 1));
    }

    printf("%lld\n", ret);

    return 0;
}