If $X$ is a Borel set and $f$ has countably many discontinuities, prove that $f:X\rightarrow \mathbf{R}$ is Borel measurable. The Problem
Good evening!  I am currently struggling with the following exercise.

Suppose $X$ is a Borel subset of $\mathbf{R}$ and $f:X\rightarrow \mathbf{R}$ is a function such that $\{x\in X: f \text{ is not continuous at } x\}$ is a countable set.  Prove $f$ is a Borel measurable function.


What I Know
Unfortunately I am pretty lost with this one.  I was told that the following observation is an important item in my toolkit for handling this problem:

To show that $f$ is a Borel measurable function, it suffices to prove that $f^{-1}((a,\infty))=\{x\in X: f(x)>a\}$ is a Borel set for all $a\in\mathbf{R}$.

I have a sneaking suspicion that 


*

*$X$ is a Borel set

*the set of discontinuities of $f$ is countable


are also equally important pieces of information here.  But I don't know why.

My Question
I think all I need here is a little push.  I have all the pieces in front of me, I think, but I don't know how they fit together.  In other words, I would really appreciate a tip on how you might approach this problem in an intuitive way.  This is my first time working with this material, so you can safely assume that I am unfamiliar with the more "advanced" theorems that could be used here.  The more basic, the better (in my case at least)!
Thank you all in advance! 
 A: Let $f_n(x)=f(\frac {[nx]} n)$. Then $f_n (x) \to f(x)$ at all points $x$ where $f$ is continuous. Each $f_n$ takes only countable number of values on unions of intervals of the type $[j/n, (j+1)/n)$ so they are all Borel measurable  functions. Imitate the proof of the fact that point-wise limits if Borel measurable functions are Borel measurable to complete the proof.
A: In the question
A function with countable discontinuities is Borel measurable.
the user Luiz Cordeiro argues as follows:
We want to show that $f^{-1}((a,\infty))$ is a Borel set (a function $f$ satisfying this is the definition of a Borel measurable function). Let $a\in \mathbf{R}$ be arbitrary and consider the set $A = f^{-1}((a,\infty))$. We can write this set as a union of its interior and the complement of the interior. That is
$$A = \mathrm{int}(A)\cup\big[A\setminus \mathrm{int}(A)\big].$$
The interior is open and thus Borel measurable. If we can show that its complement in $A$ is Borel measurable, that is $A\setminus \mathrm{int}(A)$, then since any union of Borel measurable sets is Borel measurable it would follow that $A$ is Borel measurable. This follows by the property of the Borel sets being a $\sigma$-algebra.
Let $x\in A\setminus \mathrm{int}(A)$, then $x$ is not an interior point of $A$ meaning that for every $\delta>0$ we can find a point $y_\delta$ such that 
$$|x-y_\delta|<\delta\text{ but }y_\delta \notin A.$$
What does this then mean? $A$ is the inverse of $(a,\infty)$ so where does $f(y_\delta)$ belong, certainly not to $(a,\infty)$? Is $f$ continuous at $x$?
Conclude that $A\setminus \mathrm{int}(A)$ is at most countable. How can we then argue that $A\setminus \mathrm{int}(A)$ is measurable?
