```
class Solution(object):
def threeSumSmaller(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
nums.sort()
count = 0
for i in xrange(len(nums)):
start,end = i+1,len(nums)-1
while(start < end):
if nums[start] + nums[end] < target - nums[i]:
count = count + (end-start)
start = start + 1
else:
end = end - 1
return count
```