LearnPy Hub
← Lists problems
Medium

Pairs That Add Up

Read a list of integers and a target. Count the pairs of positions (i < j) whose values add up to the target.

Input

A line of integers, then the target.

Output

A count.

Sample 1

Input
1 2 3 4 5
5
Output
2

Sample 2

Input
1 1 1
2
Output
3
solution.py
Output appears here
Pairs That Add Up · Python practice problem · LearnPy Hub