We are given n objects of identical appearance, but different mass, and a balance which can be used to compare any two objects (but only one object can be placed in each pan at a time). How many times must we use the balance to find the heaviest object and the lightest object?
To find the heaviest and lightest objects among \( n \) objects using a balance, we need to determine the minimum number of weighings required. We will use the following steps to derive the solution:

1. **Define the Problem:**
   We need to find the heaviest and lightest objects among \( n \) objects using a balance. The balance can compare two objects at a time, and we need to minimize the number of comparisons.

2. **Measure of Progress:**
   To prove that a given object is not the heaviest or the lightest, we need to display a heavier and a lighter object. We will call an object *light* if we have found a heavier object and *heavy* if we have found a lighter object. Our measure of progress will be the number of light objects plus the number of heavy objects. By the end of the algorithm, we should have a total of \( 2n - 2 \) (since we need to identify \( n-1 \) objects that are not the heaviest and \( n-1 \) objects that are not the lightest).

3. **Adversary Argument:**
   Imagine an adversary who controls the balance. If we give the adversary two objects about which we know nothing (neither heavy nor light), our progress must increase by 2 (since one will be heavier and one will be lighter). Otherwise, the adversary can make our progress increase by at most 1 (since we will only learn about one object being heavier or lighter).

4. **Progress Calculation:**
   We can only get double progress on \( \left\lfloor \frac{n}{2} \right\rfloor \) of our weighings. This is because each weighing involving two unknown objects will give us 2 units of progress. For the remaining weighings, we will get only 1 unit of progress.

5. **Minimum Number of Weighings:**
   To achieve a total progress of \( 2n - 2 \), we need to account for the weighings that give us double progress and those that give us single progress. The minimum number of weighings required is:
   \[
   2n - 2 - \left\lfloor \frac{n}{2} \right\rfloor
   \]

Therefore, the minimum number of weighings required to find both the heaviest and lightest objects among \( n \) objects is \( 2n - 2 - \left\lfloor \frac{n}{2} \right\rfloor \).

The final answer is \( \boxed{ 2n - 2 - \left\lfloor \frac{n}{2} \right\rfloor } \)