#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
void cum_sum(int N, vector<double> a, vector<double>& s) {
  for (int i = 0; i < N; i++) {
    s[i + 1] = s[i] + a[i];
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
bool is_prime(long long n) {
  if (n <= 1) return false;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p == 0) return false;
  }
  return true;
}
int getdigit(long long num) {
  unsigned digit = 0;
  while (num != 0) {
    num /= 10;
    digit++;
  }
  return digit;
}
long long N;
vector<long long> A;
long long maxi = 0;
long long dfs(long long money, long long have, int day) {
  if (day == N) {
    maxi = max(maxi, money);
    return money;
  }
  for (int j = 0; j <= money / A[day]; j++) {
    long long tmp_p = money;
    tmp_p -= A[day] * j;
    for (int k = 0; k <= have; k++) {
      long long tmp_have = have;
      long long tmp = tmp_p;
      tmp += A[day] * k;
      dfs(tmp, have + j - k, day + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  A.resize(N);
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> A[i];
  }
  long long ans = 0;
  ans = max(ans, dfs(1000, 0, 0));
  cout << ans << endl;
  cout << maxi << endl;
}
