object Main extends App{
    // Here your code !
    val pw = new java.io.PrintWriter(System.out)
    val n = io.StdIn.readLine().toInt
    var cnt=0
    
    for( i <- 1 to n )
    {
        val n = io.StdIn.readLine().split(' ').map { _.toInt }
        cnt+=(n(1)-n(0))
    }
    pw.println(cnt)
    pw.flush()
}
