Try it Online!online or verify all test cases.
How?
k-»>xWƛo4ø₅=»b7ẇ:?hiN$2ẋΠv∩vvƒ-?S2l⌊İJfvO
k- # Push [-1, 1] (will be used later)
»>xWƛo4ø₅=» # Push compressed integer 1098931065668123279355
b # Convert to binary as a list
7ẇ # Split into chunks of size 7
: # Duplicate
?h # Push the first digit of the input
i # Index it into the list
N # Negate: replace all 1s with -1
$ # Swap so the list of size-7 chunks are at the top again
2ẋΠ # Cartesian product with self
v∩ # For each, transpose
vvƒ- # For each inner pair, reduce by subtraction
?S # Push stringified input
2l # Get all overlapping pairs
⌊ # Convert them to integers
İ # Index these into the other list
J # Join the two lists together
f # Flatten
vO # Count the number of -1s and 1s in this list