Another easy prime queries

0

0 votes
Easy
Problem

Given an array A with 105 elements. Initially all the elements equals 0.

Given N segments in each of the segments your are given 2 integers X and Y you have to increase all the elements of A from X to Y by 1.Now after processing all the N segments your task is to compute how many indices from 1 to 100000 have prime values.


INPUT

First line contains N total number of segments you want to update.

Next N lines contains 2 integers X and Y you have to update each element from X to Y by 1.


OUTPUT

Number of Primes after processing all the segments.


CONSTRAINTS

1N105

1X,Y105

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?