#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int N;
int A[2511];

void MAIN() {
    scanf("%d", &N);
    A[0] = 6;
    A[1] = 10;
    A[2] = 15;
    int cnt = 3;
    for (int i=12; cnt<N; i++) {
	if (i == 6 || i == 10 || i == 15) continue;
	if (i % 6 == 0 || i % 10 == 0 || i % 15 == 0) {
	    A[cnt++] = i;
	}
    }

    rprintf("%d", A, A+N);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}


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

typedef long long lli;
int MOD = 998244353;
inline int add(const int a, const int b, const int mod = MOD) { return (a + b >= mod) ? (a + b - mod) : (a + b); }
inline void _add(int &a, const int b, const int mod = MOD) { a = add(a, b, mod); }
inline int sub(const int a, const int b, const int mod = MOD) { return (a - b < 0) ? (a - b + mod) : (a - b); }
inline void _sub(int &a, const int b, const int mod = MOD) { a = sub(a, b, mod); }
inline int negate(const int a, const int mod = MOD) { return mod - a; }
inline int mul(const int a, const int b, const int mod = MOD) { return (a * 1ll * b) % mod; }
inline void _mul(int &a, const int b, const int mod = MOD) { a = mul(a, b, mod); }
int binPow(int b, lli p, const int mod = MOD) {
	int r = 1;
	while (p) {
		if (p & 1) r = mul(r, b, mod);
		b = mul(b, b, mod);
		p >>= 1;
	}
	return r;
}
int gcdex(int a, int b, int &x, int &y) {
	if (!b) return x = 1, y = 0, a;
	int px, py, res = gcdex(b, a % b, px, py);
	return x = py, y = px - a / b * py, res;
}
int inv(const int a, const int mod = MOD) { // a and mod must be coprime
	int x, y;
	int g = gcdex(a, mod, x, y);
	assert(g == 1);
	x = (x % mod + mod) % mod;
	return x;
}
inline int dvd(const int a, const int b, const int mod = MOD) { // b and mod must be coprime
	int rev = inv(b, mod);
	return mul(a, inv(b, mod), mod);
} // b != 0
inline void _dvd(int &a, const int b, const int mod = MOD) { a = dvd(a, b, mod); } // b and mod must be coprime
inline int convert(int x, const int mod = MOD) {
	int tx = x % mod + mod;
	return tx >= mod ? tx - mod : tx;
};

int main () {
    int n;
    int i2 = inv(2);
    while (scanf("%d", &n) == 1) {
        vector<int> a(n);
        for (auto &x : a) scanf("%d", &x);
        sort(a.begin(), a.end());

        int pol = 0;
        for (int i = 0; i < n; i++) pol = add(mul(pol, 2), a[i]);
        
        int res = 0;
        for (int i = n - 1; i >= 0; i--) {
            _sub(pol, a[i]);
            _mul(pol, i2);
            _add(res, mul(a[i], add(pol, a[i])));
        }

        printf("%d\n\n", res);
    }
}


