#include <bits/stdc++.h>
using namespace std;
long long func(vector<long long>& line, long long l) {
  long long ans = 0;
  long long curr = l;
  vector<long long>::iterator it = lower_bound(line.begin(), line.end(), l);
  while (it != line.end()) {
    ans += curr;
    curr *= 2;
    it = lower_bound(it + 1, line.end(), curr);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> mine(n, 0);
  map<long long, long long> kine;
  for (int i = 0; i < n; i++) {
    cin >> mine[i];
    kine[mine[i]] += 1;
  }
  vector<long long> line;
  for (map<long long, long long>::iterator it = kine.begin(); it != kine.end();
       it++) {
    line.push_back(it->second);
  }
  long long ans = 0;
  sort(line.begin(), line.end());
  for (int i = 1; i <= 2e5; i++) {
    ans = max(ans, func(line, i));
  }
  cout << ans << endl;
  return 0;
}
