#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long sz, cnt, ans, arr[200005], s[400005];
map<long long, long long> w;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(30);
  cerr.precision(7);
  ;
  cin >> sz;
  for (int i = 0; i < sz; i++) {
    int in;
    cin >> in;
    w[in]++;
  }
  for (auto i : w) {
    arr[++cnt] = i.second;
  }
  sort(arr, arr + cnt + 1);
  for (int i = cnt; i >= 1; i--) {
    for (int j = 1; j <= arr[i]; j++) {
      s[j] = max(s[j], j + s[j * 2]);
      ans = max(ans, s[j]);
    }
  }
  cout << ans;
  return 0;
}
