Let \( n = 2^t \cdot m \), where \( t \geq 0 \), and \( m \) is odd. We will prove that \( f(n) \) is even in exactly two cases: either \( n \) is odd and \( m \equiv 1 \pmod{4} \), or \( n \) is even and \( m \equiv 3 \pmod{4} \).
First method. Consider an arbitrary fraction \( \frac{k}{n} \). If \( k \) is divisible by \( 2^{t+1} \), then the numerator of this fraction after reduction will be even; otherwise, it will be odd. Among the numbers \( 1, 2, \ldots, n - 1 \), there are exactly \( \frac{m-1}{2} \) numbers divisible by \( 2^{t+1} \). Thus, in the sum \( f(n) \), there are exactly \( n - 1 - \frac{m-1}{2} \) odd terms. Therefore, \( f(n) \) is even if and only if the numbers \( n - 1 \) and \( \frac{m-1}{2} \) have the same parity, as required.
Second method. Suppose \( n \) is odd (i.e., \( t = 0 \)). Then the numerator of the fraction \( \frac{k}{n} \) does not change parity after reduction. Thus, the number of odd numerators will be \( \frac{n-1}{2} \), and \( f(n) \) is even if and only if \( \frac{n-1}{2} \) is even, which occurs when \( m \equiv 1 \pmod{4} \).
Suppose \( n \) is even (\( t > 0 \)). Among the fractions with denominator \( n \), there is a fraction equal to \( \frac{1}{2} \) contributing 1 to \( f(n) \). All other fractions are paired as \( \left(\frac{a}{n}, \frac{n-a}{n}\right) \). Since the sum of fractions in a pair is 1, after reduction, they become pairs of irreducible fractions with the same denominator \( \left(\frac{b}{d}, \frac{d-b}{d}\right) \). The contribution of such a pair to \( f(n) \) is \( d \), and if \( d \) is even, it does not affect the parity of \( f(n) \).
Thus, the parity of \( f(n) \) is opposite to the parity of a similar sum for fractions, i.e., the parity of \( f(m) \) (for \( m = 1 \), it is opposite to the parity of \( f(1) = 0 \)). This gives the required result.
Finally, note that the numbers \( n \) and \( 2015n \) have the same parity; moreover, for odd \( m \), the numbers \( m \) and \( 2015m \) leave different remainders when divided by 4. Therefore, the numbers \( f(n) \) and \( f(2015n) \) always have different parity.