# Thomas King, Feb 25 2022
# Computes A351911 by brute force.

from itertools import combinations, chain, product
from math import floor, log

def bounds(n):
    L = 2+floor(log(n,2))
    U = L
    while sum(n-k for k in range(U)) >= 2 ** U - 1:
        U += 1
    return (L,U)

def p(A, m):
    ss = product(chain.from_iterable(
        combinations(A,j) for j in range(1,m)
    ), repeat=2)
    for X,Y in ss:
        if X != Y and sum(X) == sum(Y):
            return True
    return False

def a(n):
    L,U = bounds(n)
    m = L
    while m < U:
        for A in combinations(range(1,n+1), m):
            if not p(A, m):
                break
        else:
            break
        m += 1
    return m