Minimal sparse rulers A standard ruler of length n has distance marks at positions 0, 1, ..., n (in whichever units). A sparse ruler has a subset of those marks. A ruler can measure the distance k if it has marks at positions p and q with p−q=k.

The challenge

Given a positive integer n, output the minimum number of marks required in a sparse ruler of length n so that it can measure all distances 1, 2, ..., n.

This is OEIS A046693.

As an example, for input 6 the output is 4. Namely, a ruler with marks at 0, 1, 4, 6 works, as 1−0=1, 6−4=2, 4−1=3, 4−0=4, 6−1=5, and 6−0=6.

Additional rules


The algorithm should be valid for arbitrarily large n. However, it is acceptable if the program is limited by memory, time or data type restrictions.
Input/output can be taken/produced by any reasonable means.
Programs or functions are allowed, in any programming language. Standard loopholes are forbidden.
Shortest code in bytes wins.


Test cases

1   -&gt;   2
2   -&gt;   3
3   -&gt;   3
4   -&gt;   4
5   -&gt;   4
6   -&gt;   4
7   -&gt;   5
8   -&gt;   5
9   -&gt;   5
10  -&gt;   6
11  -&gt;   6
12  -&gt;   6
13  -&gt;   6
14  -&gt;   7
15  -&gt;   7
16  -&gt;   7
17  -&gt;   7
18  -&gt;   8
19  -&gt;   8
20  -&gt;   8
21  -&gt;   8
22  -&gt;   8
23  -&gt;   8
24  -&gt;   9
25  -&gt;   9
26  -&gt;   9
27  -&gt;   9
28  -&gt;   9
29  -&gt;   9
30  -&gt;  10
31  -&gt;  10 
32  -&gt;  10
Wolfram Language (Mathematica), 65 bytes

Tr[1^#]&amp;@@Cases[Subsets[n=0~Range~#],k_/;Union@@Abs[k-#&amp;/@k]==n]&amp;


Try it online!