P15009 [HackerEarth] Codeland is an country that started with N distinct islands, namely islands 1, 2, ..., N. But over time, the armies of some of these islands have taken over other ones. Each takeover occ
普及
题目描述

Codeland is an country that started with N distinct islands, namely islands 1, 2, ..., N. But over time, the armies of some of these islands have taken over other ones. Each takeover occurred when the army of island x invaded island y. After each invasion, all of island y became part of island x, and island y was renamed as island x.

King Ranjit, leader of Bugland, wants to invade Codeland. To do this, he needs to calculate how many distinct island still remain in Codeland after all the takeovers. Help him with this task.

Input:

The first line contains an integer N, the number of islands that were originally in Codeland.

The second line contains an integer K, denoting the number of takeovers that took place.

Each of the next K lines contains 2 space-separated integers x, y, representing that the army of island x took over that of island y. As a result, island y does not exist anymore and is now renamed as island x. It is guaranteed that island x still exists.

Output:
Output one integer, the number of islands that exist in Codeland.

Constraints:

1 ≤ N ≤ 100000

1 ≤ K ≤ 100000

SAMPLE INPUT
4
2
1 2
4 1

SAMPLE OUTPUT
2

Explanation

Codeland started with island 1, 2, 3, 4. First, island 1 invaded island 2, so island 2 was renamed to island 1. Then, island 4 invaded island 1. So what were at the beginning island 1 and 2 were renamed to island 4. Now, only island 3 and 4 remain, so the answer is 2.

输入格式

见题面

输出格式

见题面

样例输入
910 845 320 116 616 455 607 218 542 586 762 51 450 256 475 864 386 824 133 762 695 875 127 190 184 350 187 583 107 869 491 470 130 569 522 35 503 448 846 77 401 752 509 443 819 370 469 531 246 619 665 842 872 527 639 299 309 270 156 909 478 233 526 320 579 220 721 692 102 221 436 572 337 6 160 274 813 318 571 345 592 416 63 465 344 439 725 497 291 749 627 223 247 624 870 224 696 697 832 234 378 739 650 410 404 330 262 848 808 100 516 359 124 709 570 307 222 610 699 833 898 441 230 478 392 275 899 76 381 216 81 252 347 638 177 168 581 361 113 273 47 526 575 454 519 66 261 102 285 365 312 615 882 147 498 312 852 162 219 263 59 474 835 310 580 711 688 173 579 882 301 205 728 272 616 72 874 406 503 175 787 43 471 22 717 309 112 675 770 665 227 618 801 885 679 339 612 500 591 741 805 735 488 45 343 775 342 458 702 203 748 124 643 341 585 46 144 887 658 564 560 518 446 294 549 725 901 663 800 463 246 349 576 73 200 612 831 576 54 785 761 140 471 808 814 560 664 688 119 687 546 332 351 384 63 798 803 507 38 157 573 347 846 209 629 293 678 524 87 243 635 65 551 382 901 315 197 396 582 689 145 431 806 772 670 311 472 723 804 222 874 788 528 846 90 894 720 812 177 757 503 622 550 652 146 159 429 335 435 481 480 208 733 251 399 107 217 91 174 170 323 589 343 179 438 219 148 532 194 903 490 385 679 437 163 607 214 588 287 193 60 321 701 189 449 60 450 520 699 241 837 283 398 664 392 53 215 482 444 424 19 196 225 446 535 363 408 878 260 477 677 773 469 601 627 851 811 248 475 845 400 814 200 640 778 897 587 40 891 868 782 516 201 402 503 368 123 873 867 517 290 182 487 575 597 408 512 805 599 348 660 736 844 521 440 29 204 325 694 120 538 306 681 499 843 425 598 766 816 41 658 530 705 835 476 411 184 228 204 98 249 568 26 571 117 590 656 104 369 242 716 200 807 746 353 174 827 50 201 101 653 358 609 48 229 245 859 460 540 298 670 654 472 501 906 137 666 539 267 804 31 899 596 628 61 93 394 171 80 34 401 574 377 659 225 667 378 94 708 142 187 898 677 10 690 19 490 75 388 62 900 195 877 381 259 413 591 489 440 702 268 597 58 254 862 372 717 656 751 84 12 698 3 817 678 7 212 377 836 181 186 391 17 613 488 703 529 542 334 734 891 745 55 429 421 184 249 232 239 850 278 423 490 778 97 127 420 781 535 392 860 326 737 861 860 334 3 770 389 255 728 552 343 792 886 896 308 63 47 418 78 838 61 847 691 357 594 720 755 645 57 512 154 872 154 744 651 558 733 237 594 484 297 246 496 97 143 733 890 631 483 428 544 854 92 151 653 352 728 584 323 669 323 603 677 111 616 331 706 204 268 110 492 106 466 693 327 888 867 202 186 99 666 900 249 121 261 266 400 685 866 466 464 54 763 753 488 810 462 25 859 55 841 525 813 600 383 844 300 802 639 432 308 169 549 627 708 871 71 212 144 783 139 863 727 235 831 551 840 831 893 351 870 679 250 511 794 609 867 836 161 134 496 528 819 592 366 327 253 816 447 840 496 420 684 83 763 548 430 250 303 322 776 714 249 646 519 807 694 513 567 862 158 579 28 13 556 469 852 642 296 86 143 852 598 759 573 461 430 388 367 462 238 231 529 247 17 662 550 440 268 555 694 123 880 436 515 217 427 211 39 867 866 154 37 706 96 562 20 1 213 797 650 313 114 541 118 165 623 397 591 556 295 495 763 284 715 156 865 819 155 557 371 648 825 82 376 674 496 728 765 56 258 508 240 738 730 362 858 239 870 105 71 821 611 403 637 742 473 389 473 908 758 240 718 670 591 506 11 286 155 546 176 206 806 881 360 765 399 288 905 874 587 177 70 64 302 26 705 180 324 271 616 614 457 880 153 160 718 486 464 366 509 806 737 756 30 317 647 559 376 57 183 910 651 39 117 447 755 146 710 468 594 476 126 721 149 230 319 726 355 215 185 771 344 415 126 825 567 763 865 492 599 280 716 643 789 27 405 451 629 890 716 655 291 606 577 210 244 856 15 143 671 289 695 36 71 774 186 837 453 268 715 367 444 407 493 829 605 737 456 92 796 639 139 342 707 533 150 226 303 316 722 259 732 145 668 884 176 827 678 409 822 866 192 700 199 253 277 676 707 472 537 267 297 108 135 719 724 713 449 144 621 132 17 128 336 901 858 634 892 672 717 570 264 336 535 213 534 376 488 823 115 324 328 214 471 346 456 167 427 490 853 633 277 364 732 149 724 187 9 96 623 281 859 540 71 724 666 197 15 95 464 491 186 2 305 16 450 314 28 244 80 596 387 276 296 879 891 502 650 707 14 122 794 282 641 722 379 319 442 891 378 488 404 782 769 80 626 296 139 278 264 194 112 183 543 538 452 15 573 31 114 636 650 730 616 133 264 483 811 644 261 20 265 764 373 760 580 605 598 660 343 758 12 3 563 434 58 889 198 704 701 33 591 813 371 843 547 360 44 161 822 421 115 747 89 795 333 21 514 308 534 793 61 630 811 176 547 740 188 155 815 290 650 435 567 577 186 510 373 479 8 186 257 292 236 883 547 323 767 78 710 136 52 800 641 126 452 904 893 138 509 621 858 796 799 438 269 696 445 188 565 117 776 412 287 427 301 608 305 828 751 567 23 673 23 834 47 761 172 543 269 47 329 192 112 493 485 653 395 229 393 450 139 892 387 661 602 841 907 487 611 777 822 8 114 893 28 115 163 498 426 602 426 353 61 301 599 277 494 32 750 419 172 373 585 604 375 657 113 464 383 787 666 81 445 344 907 422 125 599 9 877 715 393 906 647 249 262 258 426 24 185 249 515 550 191 297 801 509 375 905 444 811 780 125 405 826 563 710 14 69 89 651 109 113 529 369 30 303 199 658 784 754 473 249 699 236 153 163 907 751 620 5 786 553 505 17 343 152 125 743 494 383 467 534 509 701 705 394 680 18 141 207 716 906 119 383 839 573 166 715 534 857 743 815 690 691 671 42 649 718 207 611 617 445 550 803 578 398 90 580 480 616 457 112 544 791 414 549 399 694 329 683 750 452 561 767 445 717 695 902 378 701 338 59 355 297 701 859 650 333 581 651 536 249 164 400 573 582 44 386 565 265 88 832 732 471 258 265 849 820 585 17 666 591 616 632 291 678 906 257 641 114 905 635 496 902 485 201 822 715 178 876 809 855 295 715 580 264 876 404 371 694 49 727 686 249 129 537 594 238 401 400 163 626 265 587 302 5 172 865 519 755 305 442 400 394 135 52 794 42 356 799 279 394 442 269 475 566 113 566 158 38 598 683 38 748 374 456 769 611 779 811 227 554 380 369 677 395 459 148 285 623 379 668 58 566 790 582 287 390 28 731 632 776 582 503 328 238 626 751 238 333 789 87 303 691 684 260 18 395 651 4 453 768 635 731 404 708 297 832 390 554 637 37 859 554 103 535 754 886 79 694 535 504 131 755 776 830 729 42 855 354 152 225 682 683 369 514 23 715 791 514 767 4 85 595 300 708 830 522 139 71 452 658 668 681 799 118 658 678 853 857 249 860 522 587 629 269 12 751 748 503 74 715 710 625 503 623 860 593 417 264 61 9 587 865 727 611 69 858 433 71 340 118 67 731 269 504 456 398 112 811 694 304 593 554 449 611 471 514 691 712 394 591 832 9 198 566 857 549 865 87 708 537 236 260 625 591 547 42 712 683 17 718 504 523 225 545 870
样例输出
15990