Some distinct positive integers were written on a blackboard such that the sum of any two integers is a power of $2$. What is the maximal possible number written on the blackboard?
1. Let's denote the distinct positive integers on the blackboard as \( a_1, a_2, \ldots, a_n \).
2. According to the problem, the sum of any two integers \( a_i + a_j \) (where \( i \neq j \)) must be a power of 2.
3. We need to determine the maximal possible number that can be written on the blackboard under this condition.

To explore this, let's consider the properties of powers of 2:
- Powers of 2 are of the form \( 2^k \) where \( k \) is a non-negative integer.
- The binary representation of a power of 2 has exactly one bit set to 1.

4. Suppose we start with the smallest positive integer, which is 1. The next number must be such that their sum is a power of 2. The smallest such number is 1 itself, but since the integers must be distinct, we consider the next possible number, which is 3 (since \( 1 + 3 = 4 = 2^2 \)).

5. Now, we have the numbers 1 and 3. The next number must form a power of 2 when added to both 1 and 3. Let's denote this number as \( x \):
   - \( 1 + x = 2^k \)
   - \( 3 + x = 2^m \)

6. Solving these equations:
   - \( x = 2^k - 1 \)
   - \( x = 2^m - 3 \)

   Equating the two expressions for \( x \):
   \[
   2^k - 1 = 2^m - 3
   \]
   \[
   2^k - 2^m = -2
   \]
   This equation holds for \( k = 2 \) and \( m = 3 \) (since \( 2^2 - 2^3 = 4 - 8 = -4 \), which is not correct). Therefore, we need to find another pair of \( k \) and \( m \).

7. Let's try \( k = 3 \) and \( m = 4 \):
   \[
   2^3 - 1 = 7
   \]
   \[
   2^4 - 3 = 13
   \]
   This does not work either. We need to find a consistent pattern.

8. Let's consider the general form \( 1, 2^k - 1 \):
   - For \( k = 2 \), we have \( 1, 3 \)
   - For \( k = 3 \), we have \( 1, 7 \)
   - For \( k = 4 \), we have \( 1, 15 \)

9. The pattern suggests that the maximal number on the blackboard can be \( 2^k - 1 \) for some large \( k \).

10. Therefore, the maximal possible number on the blackboard can be made arbitrarily large by choosing a sufficiently large \( k \).

The final answer is \( \boxed{ 2^k - 1 } \) for an arbitrarily large \( k \).