```
class Solution(object):
def eraseOverlapIntervals(self, intervals):
intervals.sort(key = lambda x: x.start)
count = 0
for i in range(len(intervals)-1):
if intervals[i].end > intervals[i+1].start:
intervals[i+1].end = min(intervals[i].end, intervals[i+1].end)
count += 1
return count
```