#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005], c[200005], dp[400005], n, m, ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    if (a[i] != a[i - 1])
      m++, b[m] = a[i], c[m] = 1;
    else
      c[m]++;
  sort(c + 1, c + m + 1);
  for (int i = m; i >= 1; i--)
    for (int j = 1; j <= c[i]; j++)
      dp[j] = max(dp[j], j + dp[j * 2]), ans = max(ans, dp[j]);
  printf("%d\n", ans);
  return 0;
}
