first thing I'd do is treat pairs of batteries as a single entity.

$Pr[\text{battery pack life}<t]=Pr[\text{battery 1 life}<t]Pr[\text{battery 2 life}<t] = t^2$

so the pdf of a battery pack lifetime is the derivative of this, i.e.

$p(t) = 2t,~t \in [0,1]$

Since we always replace an entire pack we'll consider first $n$ being even so there are $\dfrac n 2$ packs.

The lifetime of the device is just the sum of the lifetimes of these $\dfrac n 2$ packs.

Each pack has an expected lifetime of

$E[t] = \displaystyle{\int_0^1}2t^2~dt = \dfrac 2 3$

and the expected value of this sum is just the sum of the expected values so

$E[t] = \dfrac n 2 \dfrac 2 3 = \dfrac n 3$

If $n$ is odd, then the battery left over can't be used for anything and we essentially have $n-1$ batteries to make $\dfrac {n-1}{2}$ packs.

In this case $E[t] = \dfrac{n-1}{3}$

So our final expectation is

$E[t] = \dfrac{\left \lfloor \frac n 2 \right \rfloor}{3}$