a = [int(s) for s in input().split()]
g = {i: [] for i in range(1, a[0] + 1)}

for i in range(a[1]):
    c = [int(s) for s in input().split()]
    g[c[0]].append(c[1])
    g[c[1]].append(c[0])

j = 0
d = {i: False for i in range(1, a[0] + 1)}

for i in range(1, a[0] + 1):
    if d[i] == False:
        j += 1 
        d[i] = True
        if g[i] != []:
            Q = [i]
            while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m)
print(j) int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s a = [int(s) for s in input().split()] a [int(s) for s in input().split()] i: [] for i in range(1, a[0] + 1) for i in range(1, a[0] + 1) i range(1, a[0] + 1) range 1 a[0] + 1 a[0] a 0 1 for i in range(1, a[0] + 1) i [] g = {i: [] for i in range(1, a[0] + 1)} g {i: [] for i in range(1, a[0] + 1)} for i in range(a[1]):
    c = [int(s) for s in input().split()]
    g[c[0]].append(c[1])
    g[c[1]].append(c[0]) i range(a[1]) range a[1] a 1 int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s c = [int(s) for s in input().split()] c [int(s) for s in input().split()] g[c[0]].append(c[1]) [c[0]].append [c[0]] g c[0] c 0 append c[1] c 1 g[c[1]].append(c[0]) [c[1]].append [c[1]] g c[1] c 1 append c[0] c 0 j = 0 j 0 i: False for i in range(1, a[0] + 1) for i in range(1, a[0] + 1) i range(1, a[0] + 1) range 1 a[0] + 1 a[0] a 0 1 for i in range(1, a[0] + 1) i False d = {i: False for i in range(1, a[0] + 1)} d {i: False for i in range(1, a[0] + 1)} for i in range(1, a[0] + 1):
    if d[i] == False:
        j += 1 
        d[i] = True
        if g[i] != []:
            Q = [i]
            while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) i range(1, a[0] + 1) range 1 a[0] + 1 a[0] a 0 1 if d[i] == False:
        j += 1 
        d[i] = True
        if g[i] != []:
            Q = [i]
            while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) d[i] == False d[i] d i False j += 1 j 1 d[i] = True d[i] d i True if g[i] != []:
            Q = [i]
            while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) g[i] != [] g[i] g i [] Q = [i] Q [i] i while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) Q != [] Q [] r = Q.pop(0) r Q.pop(0) Q.pop Q pop 0 if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) g[r] != [] g[r] g r [] for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m) m g[r] g r if d[m] == False:
                            d[m] = True
                            Q.append(m) d[m] == False d[m] d m False d[m] = True d[m] d m True Q.append(m) Q.append Q append m print(j) print j c = [int(s) for s in input().split()] [int(s) for s in input().split()] c g = {i: [] for i in range(1, a[0] + 1)} {i: [] for i in range(1, a[0] + 1)} g d = {i: False for i in range(1, a[0] + 1)} {i: False for i in range(1, a[0] + 1)} d Q = [i] [i] Q a = [int(s) for s in input().split()] [int(s) for s in input().split()] a r = Q.pop(0) Q.pop(0) r j = 0 0 j j += 1 1 j
a = [int(s) for s in input().split()]
g = {i: [] for i in range(1, a[0] + 1)}

for i in range(a[1]):
    c = [int(s) for s in input().split()]
    g[c[0]].append(c[1])
    g[c[1]].append(c[0])

j = 0
d = {i: False for i in range(1, a[0] + 1)}

for i in range(1, a[0] + 1):
    if d[i] == False:
        j += 1 
        d[i] = True
        if g[i] != []:
            Q = [i]
            while(Q != []):
                r = Q.pop(0)
                if g[r] != []:
                    for m in g[r]:
                        if d[m] == False:
                            d[m] = True
                            Q.append(m)
print(j)