#include <bits/stdc++.h>
using namespace std;
unsigned long long int power(unsigned long long int x, long int y) {
  unsigned long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
int main() {
  long int n;
  cin >> n;
  long long int arr[n];
  map<long long int, long int> m;
  vector<long int> a;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]]++;
  }
  auto itr = m.begin();
  for (; itr != m.end(); itr++) {
    a.push_back(itr->second);
  }
  sort(a.begin(), a.end());
  unsigned long long int ans = a[a.size() - 1];
  long long res = 1;
  long long last = ans;
  for (long int i = a.size() - 2; i >= 0; i--) {
    long long int x = last / 2;
    unsigned long long int z;
    z = power(2, a.size() - i) - 1;
    if (a[i] >= x) {
      z *= x;
      last = x;
    } else {
      z *= a[i];
      last = a[i];
    }
    ans = max(ans, z);
  }
  cout << ans;
  return 0;
}
