#include <bits/stdc++.h>
using namespace std;
bool isp(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return 0;
  return x > 1;
}
int r[1010] = {
    0,       12981,   24523,   35585,   46430,   57023,   67489,   77879,
    88055,   98240,   108284,  118375,  128270,  138219,  148121,  157925,
    167675,  177433,  187048,  196709,  206333,  215966,  225463,  235069,
    244581,  253974,  263482,  272885,  282271,  291710,  301101,  310444,
    319813,  329106,  338394,  347665,  356909,  366160,  375439,  384728,
    393993,  403209,  412333,  421556,  430660,  439791,  448901,  457972,
    467135,  476215,  485275,  494311,  503251,  512383,  521398,  530472,
    539450,  548499,  557493,  566514,  575503,  584484,  593357,  602379,
    611346,  620283,  629187,  638124,  646968,  655897,  664771,  673688,
    682576,  691478,  700326,  709115,  717989,  726882,  735740,  744563,
    753318,  762199,  771012,  779827,  788611,  797361,  806180,  814963,
    823752,  832596,  841364,  850080,  858875,  867592,  876358,  885138,
    893857,  902573,  911332,  920007,  928780,  937520,  946295,  955026,
    963624,  972309,  980962,  989647,  998272,  1006935, 1015619, 1024321,
    1032962, 1041665, 1050175, 1058798, 1067388, 1076029, 1084692, 1093331,
    1101903, 1110568, 1119226, 1127772, 1136475, 1145026, 1153592, 1162244,
    1170911, 1179444, 1188093, 1196660, 1205285, 1213868, 1222393, 1230996,
    1239605, 1248112, 1256652, 1265205, 1273689, 1282286, 1290771, 1299249,
    1307765, 1316314, 1324799, 1333417, 1341880, 1350402, 1358925, 1367411,
    1375934, 1384448, 1392850, 1401374, 1409899, 1418381, 1426913, 1435430,
    1443939, 1452383, 1460920, 1469369, 1477838, 1486323, 1494787, 1503239,
    1511686, 1520184, 1528622, 1536997, 1545503, 1553884, 1562352, 1570716,
    1579176, 1587542, 1596005, 1604386, 1612824, 1621217, 1629636, 1637991,
    1646485, 1654854, 1663265, 1671700, 1680125, 1688539, 1696863, 1705278,
    1713725, 1722095, 1730436, 1738807, 1747205, 1755537, 1763839, 1772246,
    1780671, 1789019, 1797448, 1805871, 1814143, 1822528, 1830793, 1839214,
    1847581, 1855856, 1864207, 1872540, 1880878, 1889297, 1897679, 1906069,
    1914346, 1922737, 1931029, 1939421, 1947727, 1956076, 1964430, 1972724,
    1981017, 1989438, 1997721, 2006033, 2014373, 2022702, 2031020, 2039323,
    2047682, 2055971, 2064275, 2072561, 2080845, 2089097, 2097407, 2105738,
    2113990, 2122304, 2130618, 2138962, 2147172, 2155442, 2163758, 2171965,
    2180269, 2188547, 2196835, 2205083, 2213444, 2221739, 2230006, 2238231,
    2246480, 2254788, 2263079, 2271245, 2279483, 2287747, 2295997, 2304177,
    2312443, 2320691, 2328942, 2337139, 2345411, 2353608, 2361872, 2370149,
    2378388, 2386653, 2394902, 2403099, 2411351, 2419627, 2427745, 2436001,
    2444352, 2452482, 2460744, 2468912, 2477113, 2485399, 2493631, 2501804,
    2509986, 2518175, 2526330, 2534604, 2542791, 2551055, 2559256, 2567510,
    2575664, 2583836, 2592090, 2600254, 2608394, 2616565, 2624787, 2632916,
    2641068, 2649274, 2657389, 2665564, 2673788, 2682014, 2690185, 2698331,
    2706497, 2714585, 2722854, 2730937, 2739146, 2747379, 2755521, 2763725,
    2771910, 2780032, 2788181, 2796375, 2804531, 2812655, 2820817, 2828967,
    2837100, 2845296, 2853362, 2861494, 2869649, 2877770, 2885940, 2894042,
    2902173, 2910319, 2918453, 2926597, 2934703, 2942867, 2951035, 2959193,
    2967240, 2975367, 2983431, 2991612, 2999799, 3007900, 3016009, 3024129,
    3032258, 3040326, 3048458, 3056533, 3064626, 3072755, 3080941, 3089049,
    3097083, 3105214, 3113376, 3121506, 3129663, 3137800, 3145895, 3154060,
    3162037, 3170165, 3178276, 3186336, 3194439, 3202633, 3210815, 3218845,
    3226984, 3235040, 3243108, 3251142, 3259118, 3267184, 3275208, 3283348,
    3291422, 3299511, 3307587, 3315658, 3323750, 3331730, 3339778, 3347848,
    3355956, 3363969, 3372104, 3380175, 3388181, 3396270, 3404348, 3412424,
    3420476, 3428513, 3436495, 3444597, 3452685, 3460716, 3468740, 3476807,
    3484813, 3492860, 3500974, 3509080, 3517154, 3525176, 3533256, 3541338,
    3549376, 3557385, 3565457, 3573441, 3581527, 3589608, 3597609, 3605598,
    3613719, 3621779, 3629813, 3637897, 3645881, 3653950, 3662084, 3670105,
    3678172, 3686168, 3694149, 3702151, 3710195, 3718229, 3726326, 3734399,
    3742387, 3750447, 3758470, 3766488, 3774512, 3782494, 3790455, 3798471,
    3806532, 3814570, 3822594, 3830626, 3838551, 3846531, 3854488, 3862541,
    3870566, 3878498, 3886491, 3894547, 3902460, 3910369, 3918400, 3926401,
    3934443, 3942498, 3950555, 3958645, 3966568, 3974536, 3982460, 3990416,
    3998438, 4006464, 4014469, 4022481, 4030424, 4038441, 4046464, 4054424,
    4062451, 4070475, 4078473, 4086435, 4094421, 4102417, 4110356, 4118385,
    4126380, 4134353, 4142364, 4150324, 4158364, 4166236, 4174224, 4182183,
    4190141, 4198063, 4206045, 4213982, 4221985, 4229915, 4237862, 4245785,
    4253702, 4261661, 4269625, 4277598, 4285399, 4293351, 4301295, 4309218,
    4317235, 4325294, 4333234, 4341144, 4349053, 4357049, 4364926, 4372936,
    4380845, 4388879, 4396851, 4404832, 4412694, 4420721, 4428609, 4436580,
    4444490, 4452307, 4460241, 4468140, 4476148, 4484076, 4492007, 4499966,
    4507856, 4515919, 4523774, 4531708, 4539593, 4547523, 4555492, 4563438,
    4571337, 4579285, 4587326, 4595266, 4603201, 4611140, 4619006, 4626876,
    4634797, 4642678, 4650560, 4658586, 4666451, 4674351, 4682243, 4690161,
    4698103, 4706007, 4713900, 4721853, 4729855, 4737851, 4745721, 4753627,
    4761561, 4769430, 4777296, 4785262, 4793167, 4801064, 4808985, 4816891,
    4824805, 4832685, 4840681, 4848640, 4856492, 4864388, 4872296, 4880180,
    4888078, 4896011, 4903891, 4911785, 4919690, 4927573, 4935488, 4943379,
    4951297, 4959210, 4967185, 4975039, 4982941, 4990898, 4998802, 5006709,
    5014695, 5022572, 5030447, 5038280, 5046095, 5054025, 5061913, 5069825,
    5077659, 5085500, 5093333, 5101203, 5109090, 5116967, 5124845, 5132783,
    5140731, 5148606, 5156547, 5164342, 5172232, 5180106, 5187966, 5195881,
    5203797, 5211713, 5219488, 5227387, 5235256, 5243171, 5250964, 5258925,
    5266812, 5274678, 5282588, 5290378, 5298144, 5305965, 5313783, 5321597,
    5329410, 5337228, 5345130, 5353090, 5360987, 5368777, 5376687, 5384561,
    5392412, 5400260, 5408176, 5415999, 5423862, 5431730, 5439576, 5447430,
    5455226, 5463064, 5470840, 5478624, 5486492, 5494277, 5502195, 5510039,
    5517813, 5525740, 5533526, 5541485, 5549334, 5557156, 5564989, 5572922,
    5580735, 5588600, 5596537, 5604343, 5612150, 5619974, 5627890, 5635731,
    5643587, 5651328, 5659237, 5667110, 5674898, 5682698, 5690537, 5698354,
    5706173, 5713948, 5721870, 5729670, 5737555, 5745303, 5753109, 5760903,
    5768742, 5776526, 5784324, 5792263, 5800089, 5807963, 5815758, 5823533,
    5831423, 5839332, 5847110, 5854947, 5862786, 5870662, 5878520, 5886329,
    5894167, 5901946, 5909822, 5917583, 5925412, 5933314, 5941165, 5949001,
    5956845, 5964740, 5972550, 5980358, 5988135, 5995955, 6003727, 6011523,
    6019332, 6027082, 6034853, 6042691, 6050499, 6058265, 6066107, 6073902,
    6081675, 6089462, 6097313, 6105113, 6112891, 6120762, 6128580, 6136360,
    6144218, 6152008, 6159871, 6167591, 6175450, 6183213, 6191134, 6198883,
    6206615, 6214485, 6222252, 6230025, 6237903, 6245745, 6253594, 6261229,
    6268950, 6276725, 6284431, 6292248, 6300083, 6307854, 6315578, 6323413,
    6331172, 6339009, 6346739, 6354521, 6362295, 6370124, 6377932, 6385750,
    6393566, 6401309, 6409020, 6416840, 6424585, 6432352, 6440084, 6447930,
    6455682, 6463538, 6471304, 6479075, 6486895, 6494656, 6502519, 6510279,
    6518114, 6525868, 6533690, 6541470, 6549285, 6556996, 6564770, 6572574,
    6580260, 6588087, 6595957, 6603686, 6611498, 6619295, 6627012, 6634763,
    6642444, 6650124, 6657923, 6665670, 6673402, 6681238, 6688966, 6696711,
    6704527, 6712367, 6720189, 6727968, 6735695, 6743394, 6751153, 6758910,
    6766666, 6774395, 6782076, 6789787, 6797654, 6805406, 6813192, 6820939,
    6828648, 6836379, 6844146, 6851866, 6859666, 6867491, 6875182, 6882924,
    6890595, 6898361, 6906086, 6913799, 6921532, 6929345, 6937122, 6944833,
    6952622, 6960447, 6968229, 6975908, 6983701, 6991452, 6999239, 7006943,
    7014637, 7022468, 7030312, 7038006, 7045744, 7053483, 7061274, 7069099,
    7076794, 7084585, 7092253, 7099975, 7107734, 7115505, 7123329, 7131104,
    7138851, 7146532, 7154306, 7162172, 7169862, 7177687, 7185447, 7193111,
    7200837, 7208623, 7216339, 7224118, 7231835, 7239661, 7247438, 7255179,
    7262872, 7270545, 7278251, 7285994, 7293745, 7301442, 7309180, 7316887,
    7324659, 7332442, 7340210, 7347817, 7355504, 7363210, 7371013, 7378732,
    7386365, 7394032, 7401866, 7409538, 7417288, 7424989, 7432639, 7440294,
    7448114, 7455841, 7463635, 7471320, 7479118, 7486781, 7494521, 7502254,
    7509988, 7517707, 7525392, 7533105, 7540804, 7548535, 7556313, 7563980,
    7571641, 7579338, 7587022, 7594705, 7602390, 7610137, 7617858, 7625549,
    7633277, 7640910, 7648660, 7656431, 7664134, 7671776, 7679488, 7687146,
    7694861, 7702574, 7710348, 7718028, 7725778, 7733442, 7741178, 7748766,
    7756540, 7764213, 7771905, 7779545, 7787226, 7795028, 7802758, 7810459,
    7818155, 7825842, 7833550, 7841312, 7848885, 7856583, 7864364, 7872018,
    7879768, 7887428, 7895233, 7902975, 7910582, 7918312, 7926037, 7933766,
    7941378, 7949032, 7956760, 7964451, 7972124, 7979866, 7987569, 7995266,
    8002935, 8010615, 8018323, 8025983, 8033583, 8041400, 8049029, 8056748,
    8064377, 8072033, 8079782, 8087510, 8095135, 8102726, 8110337, 8118011,
    8125719};
int l, n, s, li, ni;
int main() {
  cin >> l >> n;
  s = r[n / 300000];
  if (l % 300000 == 0)
    s -= r[l / 300000];
  else if (n / 300000 - l / 300000 >= 1)
    s -= r[l / 300000 + 1];
  if (n / 300000 - l / 300000 >= 1) {
    if (l % 300000 != 0) {
      li = l / 300000 * 300000 + 300000 - 3;
      for (; li >= l; li -= 4)
        if (isp(li)) s++;
    }
    if (n % 300000 != 0) {
      ni = n / 300000 * 300000 + 1;
      for (; ni <= n; ni += 4)
        if (isp(ni)) s++;
    }
  } else {
    int i = l;
    while (i % 4 != 1) i++;
    for (; i <= n; i += 4)
      if (isp(i)) s++;
  }
  cout << s + (l <= 2 && n > 1);
  return 0;
}

### Prompt

Please create a solution in CPP to the following problem:

On the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime numbers. Bob was more original. He said that number t is his lucky number, if it can be represented as: 

t = a2 + b2,  where a, b are arbitrary positive integers.

Now, the boys decided to find out how many days of the interval [l, r] (l ≤ r) are suitable for pair programming. They decided that the day i (l ≤ i ≤ r) is suitable for pair programming if and only if the number i is lucky for Peter and lucky for Bob at the same time. Help the boys to find the number of such days.

Input

The first line of the input contains integer numbers l, r (1 ≤ l, r ≤ 3·108).

Output

In the only line print the number of days on the segment [l, r], which are lucky for Peter and Bob at the same time.

Examples

Input

3 5


Output

1


Input

6 66


Output

7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool isp(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return 0;
  return x > 1;
}
int r[1010] = {
    0,       12981,   24523,   35585,   46430,   57023,   67489,   77879,
    88055,   98240,   108284,  118375,  128270,  138219,  148121,  157925,
    167675,  177433,  187048,  196709,  206333,  215966,  225463,  235069,
    244581,  253974,  263482,  272885,  282271,  291710,  301101,  310444,
    319813,  329106,  338394,  347665,  356909,  366160,  375439,  384728,
    393993,  403209,  412333,  421556,  430660,  439791,  448901,  457972,
    467135,  476215,  485275,  494311,  503251,  512383,  521398,  530472,
    539450,  548499,  557493,  566514,  575503,  584484,  593357,  602379,
    611346,  620283,  629187,  638124,  646968,  655897,  664771,  673688,
    682576,  691478,  700326,  709115,  717989,  726882,  735740,  744563,
    753318,  762199,  771012,  779827,  788611,  797361,  806180,  814963,
    823752,  832596,  841364,  850080,  858875,  867592,  876358,  885138,
    893857,  902573,  911332,  920007,  928780,  937520,  946295,  955026,
    963624,  972309,  980962,  989647,  998272,  1006935, 1015619, 1024321,
    1032962, 1041665, 1050175, 1058798, 1067388, 1076029, 1084692, 1093331,
    1101903, 1110568, 1119226, 1127772, 1136475, 1145026, 1153592, 1162244,
    1170911, 1179444, 1188093, 1196660, 1205285, 1213868, 1222393, 1230996,
    1239605, 1248112, 1256652, 1265205, 1273689, 1282286, 1290771, 1299249,
    1307765, 1316314, 1324799, 1333417, 1341880, 1350402, 1358925, 1367411,
    1375934, 1384448, 1392850, 1401374, 1409899, 1418381, 1426913, 1435430,
    1443939, 1452383, 1460920, 1469369, 1477838, 1486323, 1494787, 1503239,
    1511686, 1520184, 1528622, 1536997, 1545503, 1553884, 1562352, 1570716,
    1579176, 1587542, 1596005, 1604386, 1612824, 1621217, 1629636, 1637991,
    1646485, 1654854, 1663265, 1671700, 1680125, 1688539, 1696863, 1705278,
    1713725, 1722095, 1730436, 1738807, 1747205, 1755537, 1763839, 1772246,
    1780671, 1789019, 1797448, 1805871, 1814143, 1822528, 1830793, 1839214,
    1847581, 1855856, 1864207, 1872540, 1880878, 1889297, 1897679, 1906069,
    1914346, 1922737, 1931029, 1939421, 1947727, 1956076, 1964430, 1972724,
    1981017, 1989438, 1997721, 2006033, 2014373, 2022702, 2031020, 2039323,
    2047682, 2055971, 2064275, 2072561, 2080845, 2089097, 2097407, 2105738,
    2113990, 2122304, 2130618, 2138962, 2147172, 2155442, 2163758, 2171965,
    2180269, 2188547, 2196835, 2205083, 2213444, 2221739, 2230006, 2238231,
    2246480, 2254788, 2263079, 2271245, 2279483, 2287747, 2295997, 2304177,
    2312443, 2320691, 2328942, 2337139, 2345411, 2353608, 2361872, 2370149,
    2378388, 2386653, 2394902, 2403099, 2411351, 2419627, 2427745, 2436001,
    2444352, 2452482, 2460744, 2468912, 2477113, 2485399, 2493631, 2501804,
    2509986, 2518175, 2526330, 2534604, 2542791, 2551055, 2559256, 2567510,
    2575664, 2583836, 2592090, 2600254, 2608394, 2616565, 2624787, 2632916,
    2641068, 2649274, 2657389, 2665564, 2673788, 2682014, 2690185, 2698331,
    2706497, 2714585, 2722854, 2730937, 2739146, 2747379, 2755521, 2763725,
    2771910, 2780032, 2788181, 2796375, 2804531, 2812655, 2820817, 2828967,
    2837100, 2845296, 2853362, 2861494, 2869649, 2877770, 2885940, 2894042,
    2902173, 2910319, 2918453, 2926597, 2934703, 2942867, 2951035, 2959193,
    2967240, 2975367, 2983431, 2991612, 2999799, 3007900, 3016009, 3024129,
    3032258, 3040326, 3048458, 3056533, 3064626, 3072755, 3080941, 3089049,
    3097083, 3105214, 3113376, 3121506, 3129663, 3137800, 3145895, 3154060,
    3162037, 3170165, 3178276, 3186336, 3194439, 3202633, 3210815, 3218845,
    3226984, 3235040, 3243108, 3251142, 3259118, 3267184, 3275208, 3283348,
    3291422, 3299511, 3307587, 3315658, 3323750, 3331730, 3339778, 3347848,
    3355956, 3363969, 3372104, 3380175, 3388181, 3396270, 3404348, 3412424,
    3420476, 3428513, 3436495, 3444597, 3452685, 3460716, 3468740, 3476807,
    3484813, 3492860, 3500974, 3509080, 3517154, 3525176, 3533256, 3541338,
    3549376, 3557385, 3565457, 3573441, 3581527, 3589608, 3597609, 3605598,
    3613719, 3621779, 3629813, 3637897, 3645881, 3653950, 3662084, 3670105,
    3678172, 3686168, 3694149, 3702151, 3710195, 3718229, 3726326, 3734399,
    3742387, 3750447, 3758470, 3766488, 3774512, 3782494, 3790455, 3798471,
    3806532, 3814570, 3822594, 3830626, 3838551, 3846531, 3854488, 3862541,
    3870566, 3878498, 3886491, 3894547, 3902460, 3910369, 3918400, 3926401,
    3934443, 3942498, 3950555, 3958645, 3966568, 3974536, 3982460, 3990416,
    3998438, 4006464, 4014469, 4022481, 4030424, 4038441, 4046464, 4054424,
    4062451, 4070475, 4078473, 4086435, 4094421, 4102417, 4110356, 4118385,
    4126380, 4134353, 4142364, 4150324, 4158364, 4166236, 4174224, 4182183,
    4190141, 4198063, 4206045, 4213982, 4221985, 4229915, 4237862, 4245785,
    4253702, 4261661, 4269625, 4277598, 4285399, 4293351, 4301295, 4309218,
    4317235, 4325294, 4333234, 4341144, 4349053, 4357049, 4364926, 4372936,
    4380845, 4388879, 4396851, 4404832, 4412694, 4420721, 4428609, 4436580,
    4444490, 4452307, 4460241, 4468140, 4476148, 4484076, 4492007, 4499966,
    4507856, 4515919, 4523774, 4531708, 4539593, 4547523, 4555492, 4563438,
    4571337, 4579285, 4587326, 4595266, 4603201, 4611140, 4619006, 4626876,
    4634797, 4642678, 4650560, 4658586, 4666451, 4674351, 4682243, 4690161,
    4698103, 4706007, 4713900, 4721853, 4729855, 4737851, 4745721, 4753627,
    4761561, 4769430, 4777296, 4785262, 4793167, 4801064, 4808985, 4816891,
    4824805, 4832685, 4840681, 4848640, 4856492, 4864388, 4872296, 4880180,
    4888078, 4896011, 4903891, 4911785, 4919690, 4927573, 4935488, 4943379,
    4951297, 4959210, 4967185, 4975039, 4982941, 4990898, 4998802, 5006709,
    5014695, 5022572, 5030447, 5038280, 5046095, 5054025, 5061913, 5069825,
    5077659, 5085500, 5093333, 5101203, 5109090, 5116967, 5124845, 5132783,
    5140731, 5148606, 5156547, 5164342, 5172232, 5180106, 5187966, 5195881,
    5203797, 5211713, 5219488, 5227387, 5235256, 5243171, 5250964, 5258925,
    5266812, 5274678, 5282588, 5290378, 5298144, 5305965, 5313783, 5321597,
    5329410, 5337228, 5345130, 5353090, 5360987, 5368777, 5376687, 5384561,
    5392412, 5400260, 5408176, 5415999, 5423862, 5431730, 5439576, 5447430,
    5455226, 5463064, 5470840, 5478624, 5486492, 5494277, 5502195, 5510039,
    5517813, 5525740, 5533526, 5541485, 5549334, 5557156, 5564989, 5572922,
    5580735, 5588600, 5596537, 5604343, 5612150, 5619974, 5627890, 5635731,
    5643587, 5651328, 5659237, 5667110, 5674898, 5682698, 5690537, 5698354,
    5706173, 5713948, 5721870, 5729670, 5737555, 5745303, 5753109, 5760903,
    5768742, 5776526, 5784324, 5792263, 5800089, 5807963, 5815758, 5823533,
    5831423, 5839332, 5847110, 5854947, 5862786, 5870662, 5878520, 5886329,
    5894167, 5901946, 5909822, 5917583, 5925412, 5933314, 5941165, 5949001,
    5956845, 5964740, 5972550, 5980358, 5988135, 5995955, 6003727, 6011523,
    6019332, 6027082, 6034853, 6042691, 6050499, 6058265, 6066107, 6073902,
    6081675, 6089462, 6097313, 6105113, 6112891, 6120762, 6128580, 6136360,
    6144218, 6152008, 6159871, 6167591, 6175450, 6183213, 6191134, 6198883,
    6206615, 6214485, 6222252, 6230025, 6237903, 6245745, 6253594, 6261229,
    6268950, 6276725, 6284431, 6292248, 6300083, 6307854, 6315578, 6323413,
    6331172, 6339009, 6346739, 6354521, 6362295, 6370124, 6377932, 6385750,
    6393566, 6401309, 6409020, 6416840, 6424585, 6432352, 6440084, 6447930,
    6455682, 6463538, 6471304, 6479075, 6486895, 6494656, 6502519, 6510279,
    6518114, 6525868, 6533690, 6541470, 6549285, 6556996, 6564770, 6572574,
    6580260, 6588087, 6595957, 6603686, 6611498, 6619295, 6627012, 6634763,
    6642444, 6650124, 6657923, 6665670, 6673402, 6681238, 6688966, 6696711,
    6704527, 6712367, 6720189, 6727968, 6735695, 6743394, 6751153, 6758910,
    6766666, 6774395, 6782076, 6789787, 6797654, 6805406, 6813192, 6820939,
    6828648, 6836379, 6844146, 6851866, 6859666, 6867491, 6875182, 6882924,
    6890595, 6898361, 6906086, 6913799, 6921532, 6929345, 6937122, 6944833,
    6952622, 6960447, 6968229, 6975908, 6983701, 6991452, 6999239, 7006943,
    7014637, 7022468, 7030312, 7038006, 7045744, 7053483, 7061274, 7069099,
    7076794, 7084585, 7092253, 7099975, 7107734, 7115505, 7123329, 7131104,
    7138851, 7146532, 7154306, 7162172, 7169862, 7177687, 7185447, 7193111,
    7200837, 7208623, 7216339, 7224118, 7231835, 7239661, 7247438, 7255179,
    7262872, 7270545, 7278251, 7285994, 7293745, 7301442, 7309180, 7316887,
    7324659, 7332442, 7340210, 7347817, 7355504, 7363210, 7371013, 7378732,
    7386365, 7394032, 7401866, 7409538, 7417288, 7424989, 7432639, 7440294,
    7448114, 7455841, 7463635, 7471320, 7479118, 7486781, 7494521, 7502254,
    7509988, 7517707, 7525392, 7533105, 7540804, 7548535, 7556313, 7563980,
    7571641, 7579338, 7587022, 7594705, 7602390, 7610137, 7617858, 7625549,
    7633277, 7640910, 7648660, 7656431, 7664134, 7671776, 7679488, 7687146,
    7694861, 7702574, 7710348, 7718028, 7725778, 7733442, 7741178, 7748766,
    7756540, 7764213, 7771905, 7779545, 7787226, 7795028, 7802758, 7810459,
    7818155, 7825842, 7833550, 7841312, 7848885, 7856583, 7864364, 7872018,
    7879768, 7887428, 7895233, 7902975, 7910582, 7918312, 7926037, 7933766,
    7941378, 7949032, 7956760, 7964451, 7972124, 7979866, 7987569, 7995266,
    8002935, 8010615, 8018323, 8025983, 8033583, 8041400, 8049029, 8056748,
    8064377, 8072033, 8079782, 8087510, 8095135, 8102726, 8110337, 8118011,
    8125719};
int l, n, s, li, ni;
int main() {
  cin >> l >> n;
  s = r[n / 300000];
  if (l % 300000 == 0)
    s -= r[l / 300000];
  else if (n / 300000 - l / 300000 >= 1)
    s -= r[l / 300000 + 1];
  if (n / 300000 - l / 300000 >= 1) {
    if (l % 300000 != 0) {
      li = l / 300000 * 300000 + 300000 - 3;
      for (; li >= l; li -= 4)
        if (isp(li)) s++;
    }
    if (n % 300000 != 0) {
      ni = n / 300000 * 300000 + 1;
      for (; ni <= n; ni += 4)
        if (isp(ni)) s++;
    }
  } else {
    int i = l;
    while (i % 4 != 1) i++;
    for (; i <= n; i += 4)
      if (isp(i)) s++;
  }
  cout << s + (l <= 2 && n > 1);
  return 0;
}

```