-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_pairs.py
34 lines (30 loc) · 26 KB
/
count_pairs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import time
from typing import List
class Solution:
def countPairs(self, deliciousness: List[int]) -> int:
t1 = time.time()
count = 0
l = len(deliciousness)
max_val = max(deliciousness)
ind = 0
power_two = []
while True:
v = 2 ** ind
power_two.append(v)
ind += 1
if v >= 2 * max_val:
break
# print(power_two)
for i in range(l):
sum = deliciousness[i]
for j in range(l - i - 1):
if (sum + deliciousness[j + i + 1]) in power_two:
count += 1
t2 = time.time()
print("Total time: {} seconds".format(t2 - t1))
return count
if __name__ == '__main__':
deliciousness = [2,14,364016,684560,4,0,6,2,56,8,12,4,10959,5425,9,7,2,2,8871,253273,487606,36682,0,4,32895,98177,1,1,0,1,939492,109084,31675,230469,6483,1709,81,175,1019,1029,0,1,190,66,1,1,240,784,447,1601,3,13,209,47,1630,14754,712,1336,1009,3087,12352,20416,268369,255919,9,7,926,98,6,10,24521,8247,160869,101275,821544,227032,2909,1187,496657,27631,5544,27224,1189,2907,1,0,39,25,100,28,783,64753,65067,469,1,15,17112,15656,1,0,2,0,442,70,37509,93563,247,265,2,1022,5,27,43,213,1762,286,46,466,73,183,0,1,16126,258,121505,927071,3,5,903,121,57234,8302,8552,122520,0,16,0,1,14,2,794,1254,56,8,44,20,637637,410939,2793,1303,0,8,20,108,5,3,18,14,0,1,8461,122611,24,104,57,7,5846,2346,0,1,1,1,45717,19819,176,1872,84835,46237,66,62,204371,319917,2,2,361588,686988,0,4,31237,1531,137,375,218,38,98,30,1725,31043,5732,2460,12299,4085,854,170,114,14,649,7543,1,1,295,3801,12371,4013,32,0,54755,76317,5,3,7620,8764,26,6,428131,96157,88,40,95,33,522642,525934,130,894,262570,786006,2007,63529,782861,265715,866814,181762,1,0,53,11,8,0,1351,697,15,1,0,2,407,105,107,149,2,0,123367,7705,17042,15726,14453,509835,3,1,19,237,1,0,1154,2942,12,52,26545,104527,1,0,212,44,711023,337553,4,0,1776,272,23283,238861,24,8,4540,11844,4607,3585,666149,382427,0,1,152,104,1059,3037,165809,96335,3644,29124,19,109,870714,177862,25387,105685,67,61,2,0,1,0,28,36,1066,64470,7,1,31634,33902,1,1,285,739,125316,136828,209,47,114406,147738,3,1,5,11,864384,184192,921303,127273,24742,40794,15798,586,1,3,0,8,4164,12220,72647,58425,1,1,17,15,117,11,0,2,383025,141263,6351,26417,918002,130574,1064,7128,15918,466,377994,146294,948,1100,207,49,408,104,121,135,1248,2848,7,121,83,45,1303,745,385,127,83,45,1054,7138,14,2,2,0,1,0,10,22,2,0,7002,1190,113032,18040,34976,227168,10,6,3,1,1,0,448,64,228645,33499,61,3,12576,3808,9,23,120335,10737,15309,1075,9,23,406740,117548,3333,29435,92428,169716,3,1,31,225,77096,53976,2,2,225,31,120629,10443,106987,24085,2,14,1554,2542,1,3,643386,405190,8,8,36,28,11199,5185,195,829,63170,67902,112,144,93,35,179,77,402862,645714,61,67,122047,9025,3300,4892,4537,60999,11518,4866,89,39,9239,56297,187203,337085,5359,60177,22693,10075,13,51,1010,1038,0,1,57,71,2,0,1,31,1845,203,493775,554801,25,7,0,32,4877,3315,76,1972,6286,10098,0,16,4,60,14,1010,1,1,1,0,54,10,290,222,208,3888,9384,23384,1048,3048,0,4,11,53,5,11,43,21,197141,65003,505,519,52,204,394,118,568548,480028,2,30,972821,75755,849849,198727,230,26,1,31,35,29,2,30,2,0,6,2,1,0,192,1856,65,63,44,20,0,1,1,0,4,12,5,3,926,98,79782,51290,178246,83898,1,1,1,0,3590,506,41,23,1656,2440,1367,2729,2,0,231,25,71,57,190040,858536,58927,72145,42,22,826,1222,114,910,0,2,789,1259,6577,1615,0,1,1314,734,0,4,87352,174792,6645,9739,517,507,58,6,0,2,363818,684758,0,4,112,912,3,5,15739,115333,45034,20502,48,80,1,0,145,879,112,16,40,24,4329,28439,152,104,27,5,1613,2483,88449,435839,534,15850,7021,25747,3877,12507,102,154,260887,1257,6399,1793,25805,39731,19,45,843490,205086,18,14,720,1328,21829,10939,197021,65123,56,8,1,1,98,30,118,10,965,1083,52,12,1744,304,11546,4838,18,14,1444,604,119026,12046,1,7,0,2,7,9,4390,11994,403490,120798,2,14,346041,702535,74393,56679,220,36,0,2,494,530,15107,1277,7886,306,48,16,7294,898,66,62,120715,403573,6935,25833,0,2,204,52,2042,2054,1,1,3,1,10147,6237,1123,2973,1989,2107,11,21,14978,17790,59,5,326,1722,1,0,2736,5456,21,11,51,13,1,0,5346,60190,1,0,35719,226425,10353,22415,8,8,6035,26733,2,0,261,251,1,7,4,0,694836,353740,2,0,2,2,0,4,119801,142343,27021,104051,0,128,3,1,503193,21095,2,0,710010,338566,4361,12023,800924,247652,10,6,6,10,869,1179,4750,3442,7886,306,0,64,1,0,100568,30504,0,2,502294,546282,2,30,1,0,1,0,10406,5978,617,1431,12,52,51770,13766,11225,513063,41794,23742,1,1,35861,29675,2531,1565,35588,29948,4,4,40104,1008472,317257,207031,0,2,2,14,26880,5888,2,14,113406,410882,64,192,0,1,23816,8952,1,1,22471,43065,870,1178,323,189,9304,7080,0,2,53,459,5,59,101959,29113,15121,50415,2,0,452383,71905,2845,5347,4,124,13,115,2045,3,125732,5340,8296,8088,217,39,4,4,12805,19963,6007,2185,1,1,2,0,28,4,300030,224258,28,4,8008,184,0,1,50625,211519,246853,277435,40705,90367,967542,81034,0,4,7,9,3351,745,43867,21669,83477,965099,5,11,64,64,1,0,36,92,7,9,74195,56877,29760,494528,313094,735482,123,901,62,962,16442,49094,1095,953,92,164,619,405,11079,5305,41,87,13580,19188,233,279,28,4,0,1,2034,14,31152,34384,11483,21285,19,13,288,736,313420,210868,32,32,78341,183803,42108,88964,23,41,7831,361,1,0,1,0,14,18,5711,2481,159,3937,201415,60729,6,26,25,487,1,1,256573,5571,54418,11118,27861,4907,5995,26773,17,239,27803,103269,465,47,96574,34498,159,97,82,942,29135,495153,318764,205524,447,3649,31519,1249,26,6,28,996,0,2,2,0,0,2,653141,395435,187,69,70542,60530,263552,260736,713,311,78139,52933,47,17,13480,2904,6500,9884,130272,394016,145,367,101,27,7,1,0,1,12686,3698,8,8,10,118,74182,56890,8,8,61696,200448,0,2,107,16277,147,365,2881,1215,4,0,400,1648,7572,620,0,2,1,0,865472,183104,333967,714609,3,13,112,16,361,16023,81,47,1999,30769,72273,58799,33,31,1,31,77439,184705,200,56,26873,5895,2,0,209208,315080,186185,862391,1,3,207924,54220,4741,11643,15,1,2,14,4,0,688,3408,177931,84213,1558,490,1,1,52909,209235,0,2,29389,3379,157,867,80,48,613,411,986,38,55166,10370,495235,29053,510,7682,108,148,32,224,80480,968096,489608,34680,84025,47047,10536,5848,7,121,1,1,493,531,2030,522258,2216,1880,98962,163182,3871,61665,2,2,1,0,0,2,3964,132,13,3,0,4,27,5,32351,417,3,5,224,288,894,130,118583,12489,702,322,1,1,1,0,917,1131,3,125,24,8,81531,49541,851,3245,114720,16352,219590,304698,159589,102555,758180,290396,1274,774,387,130685,344685,179603,8,0,4922,3270,63902,67170,4,4,0,1,5,3,44521,21015,4,0,93,419,1,15,96557,34515,3549,12835,8195,57341,38,90,2122,1974,33,479,22383,10385,2762,1334,0,1,414,98,45,83,1607,14777,157,99,162280,99864,4008,12376,9,55,826890,221686,568,456,3,5,261094,1050,70,442,8,0,32137,631,505392,18896,140,116,32393,33143,23,105,51062,14474,15125,17643,0,1,3,1,2088,6104,386577,137711,4,12,759,265,12824,19944,14785,1599,91,37,1703,31065,6122,26646,858032,190544,31,33,467,45,8,8,117311,13761,1533,2563,13,19,359674,164614,118,10,0,8,31442,1326,164,348,2496,1600,3233,13151,12988,52548,4,0,1514,2582,16472,49064,1384,15000,1,0,16,16,55629,9907,16,0,412,612,75270,449018,99628,162516,2140,1956,498572,550004,4,4,114429,16643,34856,30680,0,1,276026,248262,205,307,485790,562786,16,0,13076,3308,329,1719,13916,2468,389,1659,3,1,256075,6069,87,937,3322,774,1,0,33107,32429,2,6,0,2,1223,6969,128,384,469,43,56,200,47055,18481,27,5,7802,24966,6692,26076,3,13,1059,7133,8379,8005,1,0,14784,1600,52,12,3817,4375,2934,5258,988,3108,3385,29383,12174,20594,441,583,22,490,0,1,22848,239296,70,442,761669,286907,172,84,852856,195720,0,4,847632,200944,3,1,97,159,126053,136091,7764,8620,4420,61116,1,1,168018,94126,54161,76911,434542,614034,122,134,3,1,214115,310173,19331,504957,4,4,81472,49600,18,14,142,114,1814,2282,3479,127593,15165,1219,371553,677023,2,14,0,1,7570,8814,54441,11095,2,6,18759,14009,41,215,498,1550,1142,7050,1051,7141,3,1,46,466,21,11,2447,1649,0,4,0,2,49,15,465,47,7,1,16726,48810,185730,338558,85,43,908,1140,22488,10280,457,55,2467,1629,169,855,718401,330175,17,15,23971,8797,25,7,3358,738,58,6,95,161,3,5,12,4,3,1,0,4,4,4,49,15,27,37,1,1,117716,144428,2,0,4290,12094,56,8,8,0,3,1,69,59,3,13,976,48,292965,231323,35,221,1680,368,181335,80809,105,23,202,54,349924,174364,57904,73168,7822,8562,1,1,388,3708,28555,36981,287057,237231,5,3,443,69,1,1,32997,229147,1,3,202,54,25,7,386,126,1,1,362201,162087,10067,22701,31,97,171985,90159,742378,306198,24,8,749,275,23550,9218,16,16,46686,18850,51796,13740,850314,198262,0,2,49550,81522,325836,722740,0,1,439,1609,122,902,1114,934,89050,959526,181,1867,9344,7040,580,1468,6974,124098,0,4,5,3,4,12,404990,119298,415,97,0,4,3,1,9255,121817,15280,1104,940,84,190,322,208766,315522,119,9,409,103,2,6,22,42,4,0,0,2,202,310,0,2,520,1528,11,53,177,79,13,19,5911,10473,5,3,189523,72621,829434,219142,3173,923,101,27,6642,26126,81,47,4,0,2363,1733,21867,10901,1274,6918,1322,15062,92,36,6354,1838,64817,66255,22,10,3,1,15969,16799,33,95,0,2,21,43,461,51,3061,1035,4430,3762,2,0,6,2,997,27,64199,66873,19394,13374,0,1,278,234,42807,22729,2,2,77261,53811,3,1,341868,706708,15012,17756,16610,16158,11567,21201,1,0,59912,988664,5,11,205520,56624,2,6,110,146,51099,211045,1,0,1374,64162,196,316,72,440,50018,15518,32738,30,0,4,1,3,15267,1117,1,1,12971,3413,15,1,2,2,2,0,0,4,230,26,1546,2550,255124,7020,195,317,129009,2063,4064,32,27603,5165,383,129,0,1,0,2,2,2,417,95,1,0,9,119,3222,874,154145,894431,940525,108051,315,197,23,9,32,0,2,0,5606,2586,12,4,1,0,2783,5409,3,5,6811,1381,164,92,698110,350466,28,4,2,6,396,116,104672,26400,544,1504,260,252,4,0,32,224,2,0,11304,21464,783,241,193,319,13,3,261667,262621,3,1,200754,61390,3724,372,1489,559,27296,5472,91424,39648,6293,10091,27800,103272,23,9,1,0,28,4,208929,839647,19787,12981,204277,844299,11,5,1,1,67023,64049,1903,14481,178390,870186,82,430,0,1,5749,10635,692152,356424,113,143,549778,498798,8004,8380,51817,210327,256933,791643,0,2,109898,21174,114954,147190,173753,88391,6823,124249,254,2,27445,5323,10,22,1365,6827,874210,174366,77,51,2,6,593,1455,43,85,0,8,1417,631,614228,434348,717,307,10281,22487,29,3,1,1,14585,1799,62519,3017,573,451,24490,8278,1,1,196274,852302,99,29,17306,48230,95,33,4268,3924,1,0,17803,1030773,13,3,246,266,6,2,8,0,18737,14031,9722,1038854,945,79,37,27,27961,103111,26,6,24,488,580341,468235,16,16,0,4,172260,876316,382146,666430,366,146,11,5,0,1,351703,172585,42,22,15193,50343,39,25,111,17,387702,136586,3,253,987150,61426,3349,747,0,2,1,1,59,453,1,3,93,35,517833,6455,0,2,5,3,1035,1013,10326,120746,28432,4336,4500,3692,668,356,1806,242,1195,853,5734,2458,40,216,1571,2525,765,3331,24861,40675,85807,45265,1723,325,1102,7090,7816,8568,37,27,43751,21785,886,1162,2,2,153,871,1,1,1,1,49,463,0,1,3,13,2225,5967,227,29,1101,2995,0,4,1,1,12124,53412,2,0,48452,17084,3,1,78687,183457,4179,4013,1991,6201,7917,8467,80903,967673,384,640,438,74,608,416,7,121,3,1,22910,9858,7031,58505,310526,213762,26,38,2,2,13197,3187,6515,1677,367,145,410061,638515,8,0,1,0,196110,66034,17706,244438,99,157,84,44,57,71,28,4,588,436,1,1,858801,189775,233437,815139,277276,247012,0,1,7,25,106,150,6350,1842,7799,24969,4751,11633,117,395,374458,149830,559421,489155,1575,2521,5538,2654,0,2,124,32644,1746,14638,2,2,2,0,40,88,3781,4411,8,0,46,4050,70354,60718,1323,725,8,120,128638,133506,42277,219867,1,0,2,0,343,169,383,129,345,167,9950,22818,59,5,80815,50257,21,11,192123,332165,968,56,1387,2709,2910,13474,4,4,663,1385,1,7,65207,196937,1469,6723,77,947,392052,656524,53,11,13,51,264,248,63498,67574,747617,300959,14166,51370,47037,18499,1,7,602,1446,2352,14032,3985,111,15,49,5,11,221,35,4248,3944,20541,1028035,607648,440928,980047,68529,1462,31306,451,573,0,2,248,1800,28,4,935305,113271,96,32,89,39,652784,395792,532,3564,5590,27178,55004,10532,7953,239,78244,183900,10,6,25599,7169,0,1,6448,9936,4,0,3,5,1876,6316,447,577,12,20,1,1,432464,91824,1,3,7,1,0,4,768,256,352,160,79,49,4,12,54006,77066,8,8,1,1,1893,155,29,3,638,386,44,84,2267,5925,0,128,13300,19468,1,1,11110,513178,3551,545,10,246,193,319,886,138,111380,150764,405025,643551,422587,101701,55,9,1,1,621331,427245,819,205,55,73,2862,5330,1344,704,26,38,0,1,0,2,13240,19528,218,38,215661,46483,52151,13385,104,24,7,9,5,27,4,12,458093,590483,23445,9323,2906,13478,29598,101474,25,103,368217,156071,5,11,8594,24174,10102,55434,2,2,139,117,6554,1638,55,9,607236,441340,3,5,3861,12523,11350,5034,19803,12965,1,3,2428,5764,869,155,164,92,66439,195705,1560,2536,140758,907818,201581,60563,472,40,20,236,3,5,132,380,106417,24655,51880,472408,5,1019,113951,17121,84905,177239,45,19,20,12,18064,113008,28,36,8,0,112733,18339,405,1643,0,1,0,2,2,2,1627,31141,59,5,456,568,59,965,0,2,4,12,4032,4160,25234,40302,19443,46093,183,73,50844,473444,724,32044,6771,255373,496,16,140,884,3715,381,603,7589,230,26,311558,212730,11297,54239,143,113,488,1560,0,1,192,64,4,12,0,1,37,27,46,18,369,143,65266,270,176750,85394,2137,260007,7852,57684,0,4,54374,11162,2,0,2,0,1,3,47,465,105474,418814,2126,6066,0,1,4,0,22,42,37,27,25650,7118,214,42,2,0,1024,1024,193894,68250,67,189,67411,63661,2,0,60520,988056,395484,128804,53413,12123,5,27,0,1,527886,520690,1,7,3539,557,235047,289241,8129,63,2,6,5838,2354,2031,2065,28558,4210,36,28,7535,657,273867,774709,12,20,3,61,0,2,407,105,30654,2114,60,4,660651,387925,0,1,2302,5890,10,22,0,2,14,2,6,10,11562,21206,3,13,0,2,741,7451,13769,18999,225360,36784,1,15,257084,5060,42,22,265312,783264,75,53,36861,28675,279838,768738,981,3115,8,24,248,1800,9,23,4,12,27663,496625,21271,109801,474,550,15584,800,0,1,364,148,7641,8743,2214,1882,65868,65204,3219,877,244,12,1,7,14165,18603,461,563,21737,43799,208,816,186,838,3,13,19420,504868,14,2,31839,230305,142589,381699,10,54,26,38,11,21,13,19,64939,459349,895907,152669,104255,26817,443,1605,163,93,224485,37659,3338,4854,13,3,0,1,12,4,4480,3712,2120,1976,78,434,788713,259863,245131,17013,468564,580012,457006,591570,67455,194689,4,0,140970,907606,7,1,0,1,45550,19986,5806,10578,780,244,901,1147,11081,54455,1,0,127,129,499,3597,89,39,117,139,92577,38495,83987,47085,35525,30011,15826,246318,0,4,206904,55240,27062,104010,98,926,179,333,4,12,1,1,19716,242428,89325,41747,95,161,8815,7569,24,8,0,1,3,1,321390,727186,88,40,30663,34873,6878,9506,33,31,5969,2223,2,6,8,24,12,4,75,437,1093,3003,1650,398,9,55,77,1971,443,69,0,4,23,105,4,4,50298,15238,34408,227736,6,2,0,8,1,0,0,2,2,0,10871,5513,14606,116466,2,0,828,196,31674,99398,4894,3298,196119,852457,43452,218692,5635,2557,4,0,18327,47209,32,224,170,854,563,3533,16,0,288,1760,166142,96002,943957,104619,87224,43848,10402,5982,408021,640555,2,0,0,2,188067,74077,1004,3092,27829,37707,10066,55470,111093,19979,1,0,1261,787,946148,102428,7,9,8,0,14,2,11305,5079,56917,74155,648,1400,9297,7087,104,152,316038,208250,1,1,0,4,1,0,4,4,19,109,88,424,334963,189325,8,0,371,7821,3,13,292040,232248,1,0,675974,372602,7,1,540,484,8836,23932,5,11,59,5,38828,26708,865,159,235346,288942,1601,2495,362361,686215,39634,25902,1,0,130360,131784,28982,3786,46,82,555,469,0,4,5,59,11101,5283,1475,573,6584,26184,971,53,734,1314,135,377,491611,32677,28168,37368,349,675,81,47,0,2,12,20,31,1,21,235,1,15,82,46,400446,123842,451,573,2964,1132,25,39,4,0,16090,49446,11245,5139,9176,7208,106,1942,29,3,31,1,336,32432,6147,2045,3108,29660,8,8,227,285,28429,37107,1342,2754,47050,84022,473,39,8282,8102,4,0,3,5,59515,71557,729240,319336,244317,279971,51039,14497,69,443,109216,21856,20085,12683,0,4,1,1,26383,104689,104320,157824,32,32,0,1,323,189,108,20,154,870,215874,46270,90,38,0,1,1,1,6,2,1,0,26254,6514,507,15877,0,4,14,18,4,0,1,0,1,3,27,5,7817,375,26,6,0,2,1,0,18,46,0,2,5,59,73,55,592,1456,0,8,16,240,16,112,0,1,324,188,70775,191369,7,1,7,9,1,1,38454,27082,247530,801046,278176,770400,3934,28834,2,0,33,479,1764,284,2,0,2890,5302,107644,154500,16,0,2,0,119,137,1,1,129,127,11,5,4027,4165,912,112,12,116,0,8,7334,858,4247,28521,1210,838,0,1,2,0,0,1,5658,2534,0,4,5,27,347018,177270,37,91,14456,51080,19993,45543,462,50,0,1,3,1,53906,11630,712,312,21830,43706,27,5,0,2,13,51,0,2,13,3,0,16,204415,319873,1,0,2,2,47,17,1426,2670,1457,591,57716,990860,835,189,7,1,101,27,6,10,409866,638710,5,11,1,3,23894,41642,7,25,22871,9897,0,1,1,3,0,1,1172,2924,2003,45,2,2,111108,151036,169757,878819,1,0,1416,632,243,13,6,2,7,25,2856,1240,1916,2180,1,3,254420,7724,92406,38666,878,1170,0,1,2034,30734,0,1,2221,1875,25,39,63092,2444,6511,26257,6843,1349,42559,22977,7,9,92381,956195,12,4,31,97,15,17,1,0,54,10,147,1901,57,7,322436,726140,13,19,11745,21023,460351,63937,4542,28226,1476,2620,31582,230562,4,4,5132,11252,226,30,387,125,177,3919,403,109,174,338,5974,10410,20317,12451,0,1,75,53,127,129,2,0,290380,233908,2907,13477,0,1,27,5,341237,183051,144,880,3,1,13,115,2,14,787844,260732,0,1,58117,7419,21,43,29,99,365814,158474,180156,344132,112601,149543,32477,33059,4,0,8157,35,7,1,204853,57291,31,97,311551,212737,3018,5174,207282,54862,10,6,731,1317,8,8,52549,78523,166222,95922,6520,1672,19,493,133,891,1,1,39,217,1,3,4,0,382,1666,61796,3740,1036,1012,1011,3085,3,1,0,8,450,62,15075,115997,1,0,36946,94126,1,0,14105,18663,8849,7535,68,60,21962,10806,55177,10359,27,229,10,246,5,59,29830,232314,691011,357565,459890,64398,14189,116883,85121,45951,264,248,250128,274160,1,0,171050,877526,162166,886410,38,218,465,47,1972,76,8,0,181946,80198,14,2,864,1184,5,3,2,2,11439,4945,1764,284,40,88,32,32,164421,97723,38,218,1,0,2,0,122,6,126481,4591,3426,670,12,20,821705,226871,1502,546,59422,202722,0,4,30003,101069,160798,101346,2,6,3,61,46,18,528206,520370,69,187,2,6,34818,30718,5833,26935,3426,12958,3,29,32,0,9891,6493,141607,382681,0,1,1,0,2070,6122,20,108,20,492,248,776,0,2,19,13,1475,573,133036,391252,18493,14275,162,350,15478,906,314,710,292962,231326,99,157,58,6,30158,2610,281,743,8542,24226,3,1,777,3319,44777,86295,2784,1312,14,2,1492,2604,226,30,426,86,86,170,787898,260678,24465,41071,990,1058,9429,6955,58,70,4090,4102,438,74,54017,208127,92,164,596,1452,4,4,13626,2758,1742,2354,423774,100514,247644,14500,14636,1748,46,4050,24986,40550,3,1,0,1,506,6,512996,535580,19,109,3823,273,272031,252257,51,205,50,206,0,2,1889,159,490,1558,33345,32191,0,16,715,7477,23177,238967,1,0,12,4,2414,1682,171665,352623,298,726,480,1568,516380,7908,4,12,341,683,51,13,112773,18299,19027,46509,67182,981394,237,19,283999,764577,0,8,2,62,980,3116,28955,36581,30,2,46614,84458,105847,25225,277,747,90,422,34,222,57,7,11,21,6973,1219,39,25,100955,30117,2,0,3,1,423648,100640,0,2,33741,97331,19949,504339,0,2,0,2,4054,42,62,194,8,0,72,184,6745,26023,9,7,53654,11882,62457,986119,23,9,1,15,586,1462,4124,28644,10,6,2,0,50,14,89240,959336,38,26,2,0,764,260,144226,380062,1,1,2,2,7773,419,11,5,27,37,3,29,23087,9681,443,69,16,0,8011,181,3,61,119,393,5460,2732,0,8,69,443,2991,5201,6548,1644,15856,16912,0,1,225452,36692,495296,553280,92,36,5322,125750,422225,102063,62,2,9,23,2382,5810,103,25,349279,175009,6212,1980,14647,18121,118184,12888,104187,157957,4,4,411602,636974,0,32,0,8,25201,7567,2706,1390,20042,111030,2,2,357,155,0,1,125,3,47,81,538,3558,2630,1466,2,0,12,20,2,0,7,25,4365,3827,3,13,27947,4821,447948,76340,19416,13352,21,11,0,4,3,13,0,2,4,0,0,1,6768,1424,5,11,2,0,82164,179980,94,34,334,178,137221,124923,173942,88202,0,4,2808,5384,11195,21573,686,3410,377865,146423,129170,132974,9321,7063,53,11,247,777,120,136,3,29,1,3,3586,29182,4792,11592,2,0,111,145,7181,1011,0,2,41376,220768,7,1,124638,6434,363,3733,1,15,102413,159731,23926,41610,250,262,345,7847,21,11,20139,12629,15124,1260,6,2,25834,105238,1,0,1,7,830,194,1763,285,31,1,0,1,4,12,866,158,13521,2863,2,6,75,53,0,1,19,13,0,32,166,90,3488,608,216717,45427,4,0,1339,709,45188,20348,1,7,77,51,60958,4578,86265,175879,55,9,3,5,986,1062,88,168,1243,31525,122651,139493,110,146,3054,1042,578,32190,2199,5993,13,3,14,2,557,3539,40676,221468,6294,26474,1,15,9,7,1,0,0,1,1,0,0,32,41,87,472,40,29166,36370,81,47,82,174,819,205,9,247,131090,131054,15945,439,13485,2899,388,124,115901,15171,2268,1828,163,349,17,15,17328,244816,1,15,7224,25544,1255,2841,14116,2268,988,36,898645,149931,68,188,20,12,41,23,16,48,291928,756648,5546,10838,16073,311,98,30,126649,4423,54,202,1,0,3448,258696,2,6,1413,2683,4,0,2449,5743,6,26,634,130438,520,504,19343,13425,5,11,32,224,338548,185740,4,60,22423,10345,28,4,475,3621,3473,623,260396,263892,147980,114164,1,1,15323,1061,15119,1265,2,0,3,1,4,0,151,873,4,4,196887,65257,934997,113579,926,7266,33,31,25,7,33,95,0,1,0,1,487,3609,2,14,139,373,50,14,25,39,39509,91563,2,14,38,26,1,1,1234,814,32538,98534,29,3,89,39,23,9,56,456,21,11,653139,395437,208,48,3543,4649,3321,775,1799,30969,396,1652,2,62,11557,53979,31945,230199,413,3683,53205,12331,639,385,5,3,766,258,251,1797,286,738,218,38,349325,699251,18,46,116,140,31,1,14617,18151,19497,13271,0,1,768,1280,3,1,224,288,807,217,401640,122648,47,17,10832,120240,80,48,61605,3931,0,1,5,3,8512,7872,254,258,106,22,1,7,3,1,0,1,0,1,165,347,410,102,4785,3407,1670,260474,1169,879,0,8,5277,11107,110111,938465,1,0,6170,2022,62197,3339,127864,396424,57985,7551,228,284,26,6,16,0,16,16,32663,105,144,880,140177,384111,109465,152679,27003,5765,1670,2426,743,1305,5061,27707,10,6,95715,35357,162312,361976,5669,2523,2,0,198,314,10544,120528,14,2,5,3,64,64,6,26,0,1,0,2,4,4,0,2,1,15,135,377,57,455,138,374,18960,243184,950,74,1656,14728,366572,157716,9,23,2258,1838,20,12,113567,17505,2,30,16187,197,57496,73576,0,8,2459,1637,516783,7505,82450,48622,44108,21428,23420,42116,0,2,92,36,100034,31038,373,1675,891,1157,5,27,0,4,31205,99867,24569,40967,1932,2164,69186,192958,255398,6746,14473,51063,461769,586807,52150,13386,21095,44441,171,85,164,92,5,3,158,354,9806,6578,155,101,75413,55659,2,0,99277,31795,1,0,4735,60801,3121,975,138,374,869,155,189434,334854,88464,42608,123615,400673,374127,674449,13,3,1,1,501223,23065,0,4,11052,54484,122,134,4,0,234201,290087,419796,104492,1,0,0,4,7061,9323,0,2,666,358,8975,23793,17,47,6,10,53,11,168069,94075,6,2,1,0,3394,702,697,327,277,235,7286,906,103829,27243,129,383,4548,28220,2,0,489018,35270,894,1154,0,16,233,23,58,6,25,103,306131,218157,27,37,1,31,1467,31301,11,117,19858,111214,222,290,4108,4084,5728,2464,497,7695,408,104,3372,724,242416,281872,522,502,296,16088,842,3254,316,7876,7,1,26,6,1,0,4,0,479,33,149,107,9,7,26946,235198,9999,6385,618,32150,3851,28917,8927,7457,232,24,250346,273942,3679,4513,116,12,33,95,65250,196894,983,41,0,1,164,348,227868,34276,885840,162736,0,2,2,0,1331,717,30,2018,485,1563,69,59,49,15,52914,209230,26,38,17259,15509,225,287,4,28,3225,4967,153191,108953,12,20,747,277,5,59,3136,960,27,5,8,120,219082,305206,8615,122457,215,41,6,2,499276,25012,19,109,28112,4656,1350,6842,1,0,174,338,5,27,3914,4278,555,469,39,217,3460,62076,5,11,123684,7388,8,0,2,0,428,596,165397,96747,40,24,0,2,158,98,1,3,57962,7574,34,990,412870,635706,176,80,124037,7035,1005,1043,125436,5636,29,35,469,43,886,7306,4702,3490,22,42,14,18,16,112,5302,2890,476774,47514,1464,6728,8,0,1,0,2,0,143,113,1522,6670,1,3,848915,199661,0,1,436,15948,156731,105413,86,42,18285,14483,11,5,40,88,483570,565006,461780,62508,53918,11618,5473,2719,228749,33395,31802,966,0,2,472117,576459,117417,931159,1,0,6,2,4618,3574,297333,226955,765,3331,120196,928380,860,164,71986,190158,583799,464777,3,5,2,0,3,1,3643,4549,700,324,22015,10753,31,225,1,0,518,506,1,0,1,3,708709,339867,777,247,0,2,0,1,4,0,97272,33800,1607,2489,7,1,983,1065,494984,29304,541,483,16,0,1,0,3275,13109,4,0,128,0,13893,2491,40318,25218,11529,4855,3,1,908,1140,30696,2072,2722,1374,400,3696,142,114,874,150,62960,2576,7873,8511,71,57,63,193,1,0,942,15442,0,1,34,222,7317,875,878371,170205,277028,771548,2821,29947,14378,2006,1524,2572,48081,476207,0,16,2,14,10,22,276,236,22,42,602258,446318,1,0,4,4,698,326,0,16,1004,3092,91708,432580,309988,214300,7843,8541,216292,307996,26,6,496,7696,0,2,8,8,0,4,1,1,3,1,16387,114685,489,23,237535,286753,0,8,0,16,86824,44248,92,36,453465,70823,5,59,58,70,150,874,50792,14744,915,109,1090,3006,5151,60385,380631,143657,93,163,0,1,7263,9121,7,25,4,0,59,69,14849,1535,11,5,20,44,3,125,1,3,2890,13494,725561,323015,601,423,8,8,33575,228569,2,6,208222,53922,1873,175,15260,1124,409,615,52356,78716,12552,20216,1,0,87,41,7,1,10394,5990,4,4,3,5,7727,8657,39,25,1,0,0,2,4389,3803,67695,456593,178566,345722,465,1583,0,16,2935,1161,37050,94022,933914,114662,734,290,72,184,1698,2398,31843,925,403988,120300,72,56,0,1,1,3,692,261452,1500,548,2,0,2,0,2,0,138222,123922,180,76,32751,17,3,5,0,2,3748,348,120,136,1,0,101,27,14811,17957,9665,6719,180,76,231,1817,173210,88934,620938,427638,48,80,29898,2870,707,1341,870,1178,8,8,31524,99548,7625,1040951,684,3412,1,31,1773,6419,173849,350439,11589,21179,83,45,11,53,854452,194124,935,1113,71,441,15,113,4020,76,346,678,11201,5183,2,0,19797,12971,912130,136446,1,31,10,6,1630,418,2359,1737,1905,143,14506,18262,30,2,22,10,18,14,457880,66408,8,120,1580,468,421,91,1,1,0,1,28,100,81568,180576,388,636,389552,134736,39,25,150163,374125,31556,1212,18,14,192551,331737,13868,51668,83843,178301,3,5,16,0,163019,99125,14,114,64,0,173455,88689,26,6,46367,477921,0,1,829398,219178,2,0,2,0,31,1,16479,16289,94,930,49,15,4441,11943,718,306,100393,30679,1,0,61176,200968,513,511,43282,218862,176955,85189,59155,6381,184,72,328390,195898,1,0,38,26,2993,1103,54,10,160030,102114,43261,87811,378,134,61954,200190,440,3656,1,0,17,15,32530,238,27,5,18887,13881,2,2,5694,1042882,1237,811,1,3,298583,225705,10981,21787,55307,10229,6469,26299,495,7697,101,27,9,23,0,1,2293,5899,2,0,26979,5789,79,177,14894,1490,68834,979742,1868,2228,7808,384,88469,42603,9,7,14742,1642,50,14,1022,2,4,4,2,2,13,19,181,75,864,160,176,336,0,4,2,0,758,266,1,15,955,69,778811,269765,3288,808,7315,516973,1939,2157,19,45,6029,10355,69133,455155,30,2,251925,10219,35,989,6,10,7602,8782,19254,13514,4850,27918,10,22,86289,44783,35,93,7,1,470052,54236,2000,48,735,289,280,744,722,302,24,8,1,1,2,30,38396,27140,130022,918554,11520,54016,6568,9816,14945,1439,63,1,5,59,5275,11109,545,479,93,163,1006,3090,12229,53307,3659,12725,123753,7319,4,0,630,394,13,19,161,351,3,5,5138,3054,26783,5985,0,1,1,0,32,96,30224,2544,0,1,13517,19251,8,24,826,1222,1,3,57,455,55522,75550,234,22,13583,19185,354,158,2779,1317,9518,6866,0,2,290169,234119,1374,2722,47403,476885,4992,11392,441,1607,968288,80288,7687,8697,4,0,657904,390672,62296,3240,59693,5843,1,0,56077,206067,31,225,23705,107367,125,131,63,1,120730,141414,14547,18221,1523,2573,0,1,1945,14439,752752,295824,43,85,849,1199,51,13,47928,17608,112646,18426,12433,53103,174977,873599,3823,4369,220,292,1,0,4,0,148056,114088,258,254,3065,1031,8135,8249,110391,20681,10874,5510,0,8,5287,27481,5,3,2,0,3,5,1,3,2,2,771194,277382,2,2,5276,27492,115630,15442,6,2,1,7,112782,18290,947617,100959,129309,1763,1,0,0,1,4128,12256,169777,878799,456,56,512,1536,4,0,250,6,5600,27168,1,1,974,50,521247,3041,598902,449674,1239,809,4177,28591,0,1,30,98,14,2,2917,1179,79,49,0,4,75199,449089,5809,2383,33573,228571,16,112,212,44,3,5,415366,108922,117852,13220]
print(len(deliciousness))
count = Solution().countPairs(deliciousness)
print(count)