Divan's new cottage is finally complete! However, after a thorough inspection, it turned out that the workers had installed the insulation incorrectly, and now the temperature in the house directly depends on the temperature outside. More precisely, if the temperature in the house is $$$P$$$ in the morning, and the street temperature is $$$T$$$, then by the next morning the temperature in the house changes according to the following rule:   $$$P_{new} = P + 1$$$, if $$$P < T$$$,  $$$P_{new} = P - 1$$$, if $$$P > T$$$,  $$$P_{new} = P$$$, if $$$P = T$$$.  Here $$$P_{new}$$$ is the temperature in the house next morning.Divan is a very busy businessman, so sometimes he is not at home for long periods and does not know what the temperature is there now, so he hired you to find it. You will work for $$$n$$$ days. In the beginning of the $$$i$$$-th day, the temperature outside $$$T_i$$$ is first given to you. After that, on the $$$i$$$-th day, you will receive $$$k_i$$$ queries. Each query asks the following: "if the temperature in the house was $$$x_i$$$ at the morning of the first day, what would be the temperature in the house next morning (after day $$$i$$$)?"Please answer all the businessman's queries.

The first line of the input contains the number $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of days. The following is a description of $$$n$$$ days in the following format. The first line of the description contains an integer $$$T_i$$$ ($$$0 \leq T_i \leq 10^9$$$) — the temperature on that day. The second line contains a non-negative integer $$$k_i$$$ ($$$0 \le k_i \le 2 \cdot 10^5$$$) — the number of queries that day. The third line contains $$$k$$$ integers $$$x'_i$$$ ($$$0 \leq x'_{i} \leq 10^9$$$) — the encrypted version of Divan's queries. Let $$$lastans = 0$$$ initially. Divan's actual queries are given by $$$x_i = (x'_i + lastans) \bmod (10^9 + 1)$$$, where $$$a \bmod b$$$ is the reminder when $$$a$$$ is divided by $$$b$$$. After answering the query, set $$$lastans$$$ to the answer. It is guaranteed that the total number of queries (the sum of all $$$k_i$$$) does not exceed $$$2 \cdot 10^5$$$.

For each query, output a single integer — the temperature in the house after day $$$i$$$.

NoteLet's look at the first four queries from the example input.The temperature is $$$50$$$ on the first day, $$$50$$$ on the second day, and $$$0$$$ on the third day.Note that $$$lastans = 0$$$ initially. The initial temperature of the first query of the first day is $$$(1 \, + \, lastans) \bmod (10^9 + 1) = 1$$$. After the first day, the temperature rises by $$$1$$$, because $$$1 < 50$$$. So the answer to the query is $$$2$$$. Then, we set $$$lastans = 2$$$. The initial temperature of the second query of the first day is $$$(2 \, + \, lastans) \bmod (10^9 + 1) = 4$$$. After the first day, the temperature rises by $$$1$$$, because $$$4 < 50$$$. So the answer to the query is $$$5$$$. Then, we set $$$lastans = 5$$$. The initial temperature of the third query of the first day is $$$(3 \, + \, lastans) \bmod (10^9 + 1) = 8$$$. After the first day, the temperature rises by $$$1$$$. So the answer to the query is $$$9$$$. Then, we set $$$lastans = 9$$$. The initial temperature of the first query of the second day is $$$(4 \, + \, lastans) \bmod (10^9 + 1) = 13$$$. After the first day, the temperature rises by $$$1$$$. After the second day, the temperature rises by $$$1$$$. So the answer to the query is $$$15$$$. Then, we set $$$lastans = 15$$$.

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

type SegTreeNode struct {
	left       *SegTreeNode
	right      *SegTreeNode
	lazyAdd    int
	firstValue int
	lastValue  int
}

const MAX_DAYS = int(2e5)
const MAX_TEMPERATURE = int(1e9)

var preAllocatedNodes [140 * MAX_DAYS]SegTreeNode
var nodeCounter = 0

func newSegTreeNode(fr, to int) *SegTreeNode {
	var ref = &preAllocatedNodes[nodeCounter]
	nodeCounter++
	ref.firstValue = fr
	ref.lastValue = to
	return ref
}

func (node *SegTreeNode) work(fr, to int) {
	// create children if they don't exists
	if fr != to && node.left == nil {
		node.left = newSegTreeNode(fr, fr+(to-fr)>>1)
		node.right = newSegTreeNode((fr+(to-fr)>>1)+1, to)
	}

	// nothing to do here
	if node.lazyAdd == 0 {
		return
	}

	node.firstValue += node.lazyAdd
	node.lastValue += node.lazyAdd
	if fr != to {
		node.left.lazyAdd += node.lazyAdd
		node.right.lazyAdd += node.lazyAdd
	}
	node.lazyAdd = 0
}

func (node *SegTreeNode) query(fr, to, i int) int {
	node.work(fr, to)
	if fr == to {
		return node.firstValue
	}
	var mid = fr + (to-fr)>>1
	if mid >= i {
		return node.left.query(fr, mid, i)
	}
	return node.right.query(mid+1, to, i)
}

func (node *SegTreeNode) update(fr, to, qfr, qto, value int) {
	if fr == qfr && to == qto {
		node.lazyAdd = value
		node.work(fr, to)
		return
	}
	var mid = (fr + (to-fr)>>1)
	node.work(fr, to)
	if qto <= mid {
		node.left.update(fr, mid, qfr, qto, value)
		node.right.work(mid+1, to)
	} else if qfr > mid {
		node.left.work(fr, to)
		node.right.update(mid+1, to, qfr, qto, value)
	} else {
		node.left.update(fr, mid, qfr, mid, value)
		node.right.update(mid+1, to, mid+1, qto, value)
	}
	node.firstValue = node.left.firstValue
	node.lastValue = node.right.lastValue
}

func (node *SegTreeNode) findLowest(fr, to, temperature int) int {
	node.work(fr, to)
	if fr == to {
		return fr
	}
	node.left.work(fr, fr+(to-fr)>>1)
	if node.left.lastValue >= temperature {
		return node.left.findLowest(fr, (fr + (to-fr)>>1), temperature)
	}
	return node.right.findLowest((fr+(to-fr)>>1)+1, to, temperature)
}

func (node *SegTreeNode) findHighest(fr, to, temperature int) int {
	node.work(fr, to)
	if fr == to {
		return fr
	}
	node.right.work((fr+(to-fr)>>1)+1, to)
	if node.right.firstValue <= temperature {
		return node.right.findHighest((fr+(to-fr)>>1)+1, to, temperature)
	}
	return node.left.findHighest(fr, (fr + (to-fr)>>1), temperature)
}

var rootFr = -MAX_DAYS - 2
var rootTo = MAX_DAYS + MAX_TEMPERATURE + 2
var root = newSegTreeNode(rootFr, rootTo)

func main() {
	var nDays int
	var lastAnswer = 0
	fmt.Fscan(in, &nDays)
	for d := 0; d < nDays; d++ {
		var temperature, nQueries, queryTemperature int
		fmt.Fscan(in, &temperature)
		var lo = root.findLowest(rootFr, rootTo, temperature)
		var hi = root.findHighest(rootFr, rootTo, temperature)
		root.update(rootFr, rootTo, rootFr, lo-1, 1)
		root.update(rootFr, rootTo, hi+1, rootTo, -1)
		fmt.Fscan(in, &nQueries)
		for q := 0; q < nQueries; q++ {
			fmt.Fscan(in, &queryTemperature)
			queryTemperature = (lastAnswer + queryTemperature) % (MAX_TEMPERATURE + 1)
			lastAnswer = root.query(rootFr, rootTo, queryTemperature)
			fmt.Fprintf(out, "%d\n", lastAnswer)
		}
	}
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

type SegTree struct {
	fr         int
	to         int
	left       *SegTree
	right      *SegTree
	lazyAdd    int
	firstValue int
	lastValue  int
}

func newSegTree(fr, to int) *SegTree {
	return &SegTree{
		fr:         fr,
		to:         to,
		firstValue: fr,
		lastValue:  to,
	}
}

func (node *SegTree) work() {
	// create children if they don't exists
	if node.fr != node.to && node.left == nil {
		var mid = node.fr + (node.to-node.fr)/2
		node.left = newSegTree(node.fr, mid)
		node.right = newSegTree(mid+1, node.to)
	}

	// nothing to do here
	if node.lazyAdd == 0 {
		return
	}

	node.firstValue += node.lazyAdd
	node.lastValue += node.lazyAdd
	if node.fr != node.to {
		node.left.lazyAdd += node.lazyAdd
		node.right.lazyAdd += node.lazyAdd
	}
	node.lazyAdd = 0
}

func (node *SegTree) query(i int) int {
	node.work()
	// fmt.Fprintf(out, "query %d in [%d,%d], values are (%d,%d)\n", i, node.fr, node.to, node.firstValue, node.lastValue)
	if node.fr == node.to {
		return node.firstValue
	}
	if node.left.to >= i {
		return node.left.query(i)
	}
	return node.right.query(i)
}

func (node *SegTree) update(fr, to, value int) {
	node.work()
	if node.fr == fr && node.to == to {
		node.lazyAdd = value
		return
	}
	if to <= node.left.to {
		node.left.update(fr, to, value)
	} else if fr >= node.right.fr {
		node.right.update(fr, to, value)
	} else {
		node.left.update(fr, node.left.to, value)
		node.right.update(node.right.fr, to, value)
	}
	node.firstValue = node.left.firstValue
	node.lastValue = node.right.lastValue
}

func (node *SegTree) findLowest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.left.lastValue >= temperature {
		return node.left.findLowest(temperature)
	}
	return node.right.findLowest(temperature)
}

func (node *SegTree) findHighest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.right.firstValue <= temperature {
		return node.right.findHighest(temperature)
	}
	return node.left.findHighest(temperature)
}

const MAX_DAYS = int(2e5)
const MAX_TEMPERATURE = int(1e9)

var root = newSegTree(
	-MAX_DAYS-MAX_TEMPERATURE-100,
	MAX_DAYS+MAX_TEMPERATURE+100,
)

func main() {
	var nDays int
	var lastAnswer = 0
	fmt.Fscan(in, &nDays)
	for d := 0; d < nDays; d++ {
		var temperature, nQueries, queryTemperature int
		fmt.Fscan(in, &temperature)
		var lo = root.findLowest(temperature)
		var hi = root.findHighest(temperature)
		root.update(root.fr, lo-1, 1)
		root.update(hi+1, root.to, -1)
		fmt.Fscan(in, &nQueries)
		for q := 0; q < nQueries; q++ {
			fmt.Fscan(in, &queryTemperature)
			queryTemperature = (lastAnswer + queryTemperature) % (MAX_TEMPERATURE + 1)
			lastAnswer = root.query(queryTemperature)
			// fmt.Fprintf(out, "query(%d) = %d\n", queryTemperature, lastAnswer)
			fmt.Fprintf(out, "%d\n", lastAnswer)
		}
	}
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

type SegTree struct {
	fr         int
	to         int
	left       *SegTree
	right      *SegTree
	lazyAdd    int
	firstValue int
	lastValue  int
}

func newSegTree(fr, to int) *SegTree {
	return &SegTree{
		fr:         fr,
		to:         to,
		firstValue: fr,
		lastValue:  to,
	}
}

func (node *SegTree) work() {
	// create children if they don't exists
	if node.fr != node.to && node.left == nil {
		var mid = node.fr + (node.to-node.fr)/2
		node.left = newSegTree(node.fr, mid)
		node.right = newSegTree(mid+1, node.to)
	}

	// nothing to do here
	if node.lazyAdd == 0 {
		return
	}

	node.firstValue += node.lazyAdd
	node.lastValue += node.lazyAdd
	if node.fr != node.to {
		node.left.lazyAdd += node.lazyAdd
		node.right.lazyAdd += node.lazyAdd
	}
	node.lazyAdd = 0
}

func (node *SegTree) query(i int) int {
	node.work()
	// fmt.Fprintf(out, "query %d in [%d,%d], values are (%d,%d)\n", i, node.fr, node.to, node.firstValue, node.lastValue)
	if node.fr == node.to {
		return node.firstValue
	}
	if node.left.to >= i {
		return node.left.query(i)
	}
	return node.right.query(i)
}

func (node *SegTree) update(fr, to, value int) {
	node.work()
	if node.fr == fr && node.to == to {
		node.lazyAdd = value
		return
	}
	if to <= node.left.to {
		node.left.update(fr, to, value)
	} else if fr >= node.right.fr {
		node.right.update(fr, to, value)
	} else {
		node.left.update(fr, node.left.to, value)
		node.right.update(node.right.fr, to, value)
	}
}

func (node *SegTree) findLowest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.left.lastValue >= temperature {
		return node.left.findLowest(temperature)
	}
	return node.right.findLowest(temperature)
}

func (node *SegTree) findHighest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.right.firstValue <= temperature {
		return node.right.findHighest(temperature)
	}
	return node.left.findHighest(temperature)
}

const MAX_DAYS = int(2e5)
const MAX_TEMPERATURE = int(1e9)

var root = newSegTree(
	-MAX_DAYS-MAX_TEMPERATURE-100,
	MAX_DAYS+MAX_TEMPERATURE+100,
)

func main() {
	var nDays int
	var lastAnswer = 0
	fmt.Fscan(in, &nDays)
	for d := 0; d < nDays; d++ {
		var temperature, nQueries, queryTemperature int
		fmt.Fscan(in, &temperature)
		var lo = root.findLowest(temperature)
		var hi = root.findHighest(temperature)
		root.update(root.fr, lo-1, 1)
		root.update(hi+1, root.to, -1)
		fmt.Fscan(in, &nQueries)
		for q := 0; q < nQueries; q++ {
			fmt.Fscan(in, &queryTemperature)
			queryTemperature = (lastAnswer + queryTemperature) % (MAX_TEMPERATURE + 1)
			lastAnswer = root.query(queryTemperature)
			fmt.Fprintf(out, "%d\n", lastAnswer)
		}
	}
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

type SegTree struct {
	fr         int
	to         int
	left       *SegTree
	right      *SegTree
	lazyAdd    int
	firstValue int
	lastValue  int
}

func newSegTree(fr, to int) *SegTree {
	return &SegTree{
		fr:         fr,
		to:         to,
		firstValue: fr,
		lastValue:  to,
	}
}

func (node *SegTree) work() {
	// create children if they don't exists
	if node.fr != node.to && node.left == nil {
		var mid = node.fr + (node.to-node.fr)/2
		node.left = newSegTree(node.fr, mid)
		node.right = newSegTree(mid+1, node.to)
	}

	// nothing to do here
	if node.lazyAdd == 0 {
		return
	}

	node.firstValue += node.lazyAdd
	node.lastValue += node.lazyAdd
	if node.fr != node.to {
		node.left.lazyAdd += node.lazyAdd
		node.right.lazyAdd += node.lazyAdd
	}
	node.lazyAdd = 0
}

func (node *SegTree) query(i int) int {
	node.work()
	// fmt.Fprintf(out, "query %d in [%d,%d], values are (%d,%d)\n", i, node.fr, node.to, node.firstValue, node.lastValue)
	if node.fr == node.to {
		return node.firstValue
	}
	if node.left.to >= i {
		return node.left.query(i)
	}
	return node.right.query(i)
}

func (node *SegTree) update(fr, to, value int) {
	node.work()
	if node.fr == fr && node.to == to {
		node.lazyAdd = value
		return
	}
	if to <= node.left.to {
		node.left.update(fr, to, value)
	} else if fr >= node.right.fr {
		node.right.update(fr, to, value)
	} else {
		node.left.update(fr, node.left.to, value)
		node.right.update(node.right.fr, to, value)
	}
}

func (node *SegTree) findLowest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.left.lastValue >= temperature {
		return node.left.findLowest(temperature)
	}
	return node.right.findLowest(temperature)
}

func (node *SegTree) findHighest(temperature int) int {
	node.work()
	if node.fr == node.to {
		return node.fr
	}
	node.left.work()
	node.right.work()
	if node.right.firstValue <= temperature {
		return node.right.findHighest(temperature)
	}
	return node.left.findLowest(temperature)
}

const MAX_DAYS = int(2e5)
const MAX_TEMPERATURE = int(1e9)

var root = newSegTree(
	-MAX_DAYS-MAX_TEMPERATURE-100,
	MAX_DAYS+MAX_TEMPERATURE+100,
)

func main() {
	var nDays int
	var lastAnswer = 0
	fmt.Fscan(in, &nDays)
	for d := 0; d < nDays; d++ {
		var temperature, nQueries, queryTemperature int
		fmt.Fscan(in, &temperature)
		var lo = root.findLowest(temperature)
		var hi = root.findHighest(temperature)
		root.update(root.fr, lo-1, 1)
		root.update(hi+1, root.to, -1)
		fmt.Fscan(in, &nQueries)
		for q := 0; q < nQueries; q++ {
			fmt.Fscan(in, &queryTemperature)
			queryTemperature = (lastAnswer + queryTemperature) % (MAX_TEMPERATURE + 1)
			lastAnswer = root.query(queryTemperature)
			fmt.Fprintf(out, "%d\n", lastAnswer)
		}
	}
	out.Flush()
}


Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them.Fox Ciel needs to assign an officer to each city. Each officer has a rank — a letter from 'A' to 'Z'. So there will be 26 different ranks, and 'A' is the topmost, so 'Z' is the bottommost.There are enough officers of each rank. But there is a special rule must obey: if x and y are two distinct cities and their officers have the same rank, then on the simple path between x and y there must be a city z that has an officer with higher rank. The rule guarantee that a communications between same rank officers will be monitored by higher rank officer.Help Ciel to make a valid plan, and if it's impossible, output "Impossible!".

The first line contains an integer n (2 ≤ n ≤ 105) — the number of cities in Tree Land. Each of the following n - 1 lines contains two integers a and b (1 ≤ a, b ≤ n, a ≠ b) — they mean that there will be an undirected road between a and b. Consider all the cities are numbered from 1 to n. It guaranteed that the given graph will be a tree.

If there is a valid plane, output n space-separated characters in a line — i-th character is the rank of officer in the city with number i.  Otherwise output "Impossible!".

NoteIn the first example, for any two officers of rank 'B', an officer with rank 'A' will be on the path between them. So it is a valid solution.

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	io := NewFastIO(os.Stdin, os.Stdout)
	defer io.Flush()

	n := io.NextInt()
	g := make([][]int, n+1)
	for i := 0; i < n-1; i++ {
		u, v := io.NextInt(), io.NextInt()
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}

	ans := make([]int, n+1)
	centroidDecompose(g, func(u int, d int) { ans[u] = 'A' + d })
	for i := 1; i <= n; i++ {
		io.Print(string(ans[i]), " ")
	}
	io.Println()
}

func centroidDecompose(g [][]int, f func(int, int)) {
	remove := func(u, v int) {
		j := len(g[u]) - 1
		for i, x := range g[u] {
			if x == v {
				g[u][i] = g[u][j]
				g[u] = g[u][:j]
				return
			}
		}
	}

	sz := make([]int, len(g))
	var calcSz func(int)
	calcSz = func(u int) {
		sz[u] = 1
		for _, v := range g[u] {
			remove(v, u)
			calcSz(v)
			sz[u] += sz[v]
		}
	}
	calcSz(1)

	var getCentroid func(int) int
	getCentroid = func(u int) int {
		for _, v := range g[u] {
			if sz[v]*2 > sz[u] {
				remove(u, v)
				g[v], sz[u], sz[v] = append(g[v], u), sz[u]-sz[v], sz[u]
				return getCentroid(v)
			}
		}
		return u
	}

	var decompose func(u, d int)
	decompose = func(u, d int) {
		cen := getCentroid(u)
		f(cen, d)
		for _, v := range g[cen] {
			remove(v, cen)
			decompose(v, d+1)
		}
	}
	decompose(1, 0)
}

type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF321C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n, v, w int
	Fscan(in, &n)
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}
	type node struct{ dep, fa int }
	nodes := make([]node, n)
	var _f func(v, fa, d int)
	_f = func(v, fa, d int) {
		nodes[v] = node{d, fa}
		for _, w := range g[v] {
			if w != fa {
				_f(w, v, d+1)
			}
		}
	}
	_f(0, -1, 0)

	used := make([]bool, n)
	size := make([]int, n)
	var calcSize func(v, fa int) int
	calcSize = func(v, fa int) int {
		sz := 1
		for _, w := range g[v] {
			if w != fa && !used[w] {
				sz += calcSize(w, v)
			}
		}
		size[v] = sz
		return sz
	}
	var compSize int
	var find func(v, fa int) int
	find = func(v, fa int) int {
		for _, w := range g[v] {
			if w != fa && !used[w] && size[w] > compSize>>1 {
				return find(w, v)
			}
		}
		return v
	}

	ans := make([]byte, n)
	var f func(int, byte)
	f = func(v int, rk byte) {
		calcSize(v, -1)
		compSize = size[v]
		ct := find(v, -1)
		used[ct] = true
		ans[ct] = rk
		for _, w := range g[ct] {
			if !used[w] {
				f(w, rk+1)
			}
		}
	}
	f(0, 'A')
	for _, b := range ans {
		Fprint(out, string(b)+" ")
	}
}

func main() { CF321C(os.Stdin, os.Stdout) }


Given a string $$$s$$$ of length $$$n$$$ and integer $$$k$$$ ($$$1 \le k \le n$$$). The string $$$s$$$ has a level $$$x$$$, if $$$x$$$ is largest non-negative integer, such that it's possible to find in $$$s$$$:  $$$x$$$ non-intersecting (non-overlapping) substrings of length $$$k$$$,  all characters of these $$$x$$$ substrings are the same (i.e. each substring contains only one distinct character and this character is the same for all the substrings). A substring is a sequence of consecutive (adjacent) characters, it is defined by two integers $$$i$$$ and $$$j$$$ ($$$1 \le i \le j \le n$$$), denoted as $$$s[i \dots j]$$$ = "$$$s_{i}s_{i+1} \dots s_{j}$$$".For example, if $$$k = 2$$$, then:  the string "aabb" has level $$$1$$$ (you can select substring "aa"),  the strings "zzzz" and "zzbzz" has level $$$2$$$ (you can select two non-intersecting substrings "zz" in each of them),  the strings "abed" and "aca" have level $$$0$$$ (you can't find at least one substring of the length $$$k=2$$$ containing the only distinct character). Zuhair gave you the integer $$$k$$$ and the string $$$s$$$ of length $$$n$$$. You need to find $$$x$$$, the level of the string $$$s$$$.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the length of the string and the value of $$$k$$$. The second line contains the string $$$s$$$ of length $$$n$$$ consisting only of lowercase Latin letters.

Print a single integer $$$x$$$ — the level of the string.

NoteIn the first example, we can select $$$2$$$ non-intersecting substrings consisting of letter 'a': "(aa)ac(aa)bb", so the level is $$$2$$$.In the second example, we can select either substring "a" or "b" to get the answer $$$1$$$.

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

func main() {
	var n, k int
	var s string
	fmt.Fscan(in, &n, &k, &s)
	m := make(map[byte]int)
	cur := s[0]
	cnt := 0
	for i := range s {
		if s[i] == cur {
			cnt++
			if cnt == k {
				m[cur]++
				cnt = 0
			}
		} else {
			cnt = 1
			cur = s[i]
		}
	}
	x := 0
	for _, y := range m {
		if x < y {
			x = y
		}
	}
	fmt.Println(x)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m int

	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	str := make([]byte,n)
	fmt.Fscanf(buf, "%s", &str)
	dp := make([]int,26)
	front := 0
	rear := 0
	for front < n{
		for rear < n&&str[rear] == str[front]{
			rear++
		}
		p := int(str[front]-byte('a'))
		dp[p] += (rear-front)/m
		front = rear
	}
	ans := 0
	for i:= 0;i < 26;i++{
		if ans < dp[i]{
			ans = dp[i]
		}
	}
	fmt.Printf("%d\n",ans)

}
/*
11 3
aaabbaabbbb

2 8
1 2 1 2 1 1 1 1
*/

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, m := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &m)
	s := ""
	fmt.Fscanf(in, "%s\n", &s)
	ans := 0
	for i := 'a'; i <= 'z'; i++ {
		curAns := 0
		j := 0
		for j < len(s) {
			for j < len(s) && s[j] != byte(i) {
				j++
			}
			k := 0
			for j < len(s) && s[j] == byte(i) {
				k++
				j++
			}
			curAns += k / m
		}
		if curAns > ans {
			ans = curAns
		}
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }
func scanf(format string, a ...interface{}) { fmt.Fscanf(reader, format, a...) }

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

///==========---------- End of Precode ----------==========///

func main() {
	defer writer.Flush() /// MUST BE EXECUTED

	n, k, s := 0, 0, ""
	scanf("%d %d\n%s", &n, &k, &s)

	last, v, p := "", make([]int, 0), make([]int, 0)
	for _, c := range s {
		if string(c) == last {
			v[len(v) - 1] += 1
		} else {
			v = append(v, 1)
			p = append(p, int(c))
			last = string(c)
		}
	}

	res := 0
	for i := 'a'; i <= 'z'; i++ {
		c := 0
		for j := range v {
			if p[j] == int(i) {
				c += v[j] / k
			}
		}
		res = max(res, c)
	}

	printf("%d\n", res)
}

package main

import (
	"fmt"
)

//var in = bufio.NewScanner(os.Stdin)
//
//func init() {
//	in.Split(bufio.ScanWords)
//}
//
//func Int() int {
//	in.Scan()
//	r := 0
//	for _, c := range in.Bytes() {
//		r *= 10
//		r += int(c - '0')
//	}
//	return r
//}
//
//func Str() string {
//	in.Scan()
//	r := ""
//	for _, c := range in.Bytes() {
//		r += string(c)
//	}
//	return r
//}

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

///==========---------- End of Precode ----------==========///

func main() {
	//_, k, s := Int(), Int(), Str()
	n, k := 0, 0
	s := ""

	fmt.Scanf("%d %d\n%s", &n, &k, &s)

	last, v, p := "", make([]int, 0), make([]int, 0)
	for _, c := range s {
		if string(c) == last {
			v[len(v) - 1] += 1
		} else {
			v = append(v, 1)
			p = append(p, int(c))
			last = string(c)
		}
	}

	res := 0
	for i := 'a'; i <= 'z'; i++ {
		c := 0
		for j := range v {
			if p[j] == int(i) {
				c += v[j] / k
			}
		}
		res = max(res, c)
	}

	fmt.Printf("%d\n", res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	buf := make([]byte, 5000000)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(buf, 5000000)
	scanner.Scan()

	dd := strings.Split(scanner.Text(), " ")
	k, _ := strconv.Atoi(dd[1])
	var current int = -1
	var length int
	d := make([]int, 26)
	scanner.Scan()
	mv := 0
	for _, v := range scanner.Text() {
		dv := int(v - 'a')
		if k == 1 {
			d[dv] += 1
			if d[dv] > mv {
				mv = d[dv]
			}
		} else if current == dv {
			length += 1
			if length == k {
				d[current] += 1
				if d[current] > mv {
					mv = d[current]
				}
				current = -1
			}
		} else {
			current = dv
			length = 1
		}

	}
	fmt.Println(mv)
}

package main

import "fmt"

func MinMax(array []int) (int, int) {
    var max int = array[0]
    var min int = array[0]
    for _, value := range array {
        if max < value {
            max = value
        }
        if min > value {
            min = value
        }
    }
    return min, max
}

func  main() {
	var length, k int;
	var input string;

	fmt.Scanf("%d %d\n", &length, &k);
	fmt.Scanf("%s\n", &input);

	var letterDB map[string]map[int]int = make(map[string]map[int]int);

	for i:=0; i < len(input); i++ {
		letterDB[ string(input[i]) ] = make(map[int]int);
	}

	// fmt.Println(letterDB);

	input = input + " "
	for patternLength, i:= 1, 0; i < len(input) - 1; i++ {
		if input[i] == input[i+1] {
			patternLength += 1;
		} else {

			if _, ok := letterDB[string(input[i])][patternLength]; ok {
				letterDB[string(input[i])][patternLength] += 1;
			} else {
				letterDB[string(input[i])][patternLength] = 1;
			}

			patternLength = 1;

		}
	}

	// fmt.Println(letterDB);

	var rankDB map[string]int = make(map[string]int);

	for letter := range letterDB {
		var rank int = 0;
		for patternLength, count := range letterDB[letter] {
			rank += (patternLength/k) * count;
		}
		rankDB[letter] = rank;
	}

	// fmt.Println(rankDB);

	ranks := make([]int, length);
	for _, val := range rankDB {
		ranks = append(ranks, val);
	}

	_, rank := MinMax(ranks);

	fmt.Println(rank);

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewScanner(os.Stdin)

func init() {
	in.Split(bufio.ScanWords)
}

func Int() int {
	in.Scan()
	r := 0
	for _, c := range in.Bytes() {
		r *= 10
		r += int(c - '0')
	}
	return r
}

func Str() string {
	in.Scan()
	r := ""
	for _, c := range in.Bytes() {
		r += string(c)
	}
	return r
}

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

///==========---------- End of Precode ----------==========///

func main() {
	_, k, s := Int(), Int(), Str()

	last, v, p := "", make([]int, 0), make([]int, 0)
	for _, c := range s {
		if string(c) == last {
			v[len(v) - 1] += 1
		} else {
			v = append(v, 1)
			p = append(p, int(c))
			last = string(c)
		}
	}

	res := 0
	for i := 'a'; i <= 'z'; i++ {
		c := 0
		for j := range v {
			if p[j] == int(i) && v[j] >= k {
				c += v[j] / k
			}
		}
		res = max(res, c)
	}

	fmt.Printf("%d", res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewScanner(os.Stdin)

func init() {
	in.Split(bufio.ScanWords)
}

func Int() int {
	in.Scan()
	r := 0
	for _, c := range in.Bytes() {
		r *= 10
		r += int(c - '0')
	}
	return r
}

func Str() string {
	in.Scan()
	r := ""
	for _, c := range in.Bytes() {
		r += string(c)
	}
	return r
}

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

///==========---------- End of Precode ----------==========///

func main() {
	_, k, s := Int(), Int(), Str()

	last, v, p := "", make([]int, 0), make([]int, 0)
	for _, c := range s {
		if string(c) == last {
			v[len(v) - 1] += 1
		} else {
			v = append(v, 1)
			p = append(p, int(c))
			last = string(c)
		}
	}

	res := 0
	for i := 'a'; i <= 'z'; i++ {
		c := 0
		for j := range v {
			if p[j] == int(i) && v[j] >= k {
				c++
			}
		}
		res = max(res, c)
	}

	fmt.Printf("%d", res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewScanner(os.Stdin)

func init() {
	in.Split(bufio.ScanWords)
}

func Int() int {
	in.Scan()
	r := 0
	for _, c := range in.Bytes() {
		r *= 10
		r += int(c - '0')
	}
	return r
}

func Str() string {
	in.Scan()
	r := ""
	for _, c := range in.Bytes() {
		r += string(c)
	}
	return r
}

func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

///==========---------- End of Precode ----------==========///

func main() {
	_, k, s := Int(), Int(), Str()

	last, v, p := "", make([]int, 0), make([]int, 0)
	for _, c := range s {
		if string(c) == last {
			v[len(v) - 1] += 1
		} else {
			v = append(v, 1)
			p = append(p, int(c))
			last = string(c)
		}
	}

	res := 0
	for i := 'a'; i <= 'z'; i++ {
		c := 0
		for j := range v {
			if p[j] == int(i) {
				c += v[j] / k
			}
		}
		res = max(res, c)
	}

	fmt.Printf("%d\n", res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	dd := strings.Split(scanner.Text(), " ")
	k, _ := strconv.Atoi(dd[1])
	var current int = -1
	var length int
	d := make([]int, 26)
	scanner.Scan()
	mv := 0
	for _, v := range scanner.Text() {
		dv := int(v - 'a')
		if k == 1 {
			d[dv] += 1
			if d[dv] > mv {
				mv = d[dv]
			}
		} else if current == dv {
			length += 1
			if length == k {
				d[current] += 1
				if d[current] > mv {
					mv = d[current]
				}
				current = -1
			}
		} else {
			current = dv
			length = 1
		}

	}
	fmt.Println(d)
	fmt.Println(mv)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	dd := strings.Split(scanner.Text(), " ")
	k, _ := strconv.Atoi(dd[1])
	var current int = -1
	var length int
	d := make([]int, 26)
	scanner.Scan()
	mv := 0
	for _, v := range scanner.Text() {
		dv := int(v - 'a')
		if current == dv {
			length += 1
			if length == k {
				d[current] += 1
				if d[current] > mv {
					mv = d[current]
				}
				current = -1
			}
		} else {
			current = dv
			length = 1
		}

	}
	fmt.Println(mv)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	dd := strings.Split(scanner.Text(), " ")
	k, _ := strconv.Atoi(dd[1])
	var current int = -1
	var length int
	d := make([]int, 26)
	scanner.Scan()
	mv := 0
	for _, v := range scanner.Text() {
		dv := int(v - 'a')
		if k == 1 {
			d[dv] += 1
			if d[dv] > mv {
				mv = d[dv]
			}
		} else if current == dv {
			length += 1
			if length == k {
				d[current] += 1
				if d[current] > mv {
					mv = d[current]
				}
				current = -1
			}
		} else {
			current = dv
			length = 1
		}

	}
	fmt.Println(mv)
}

package main

import "fmt"

type input string;

// type letter string;
// type _repCount map[int]int;
// type letterDB map[letter]_repCount;

func MinMax(array []int) (int, int) {
    var max int = array[0]
    var min int = array[0]
    for _, value := range array {
        if max < value {
            max = value
        }
        if min > value {
            min = value
        }
    }
    return min, max
}

func  main() {
	var length, k int;
	var input string;

	fmt.Scanf("%d %d", &length, &k);
	fmt.Scanf("%s", &input);

	var letterDB map[string]map[int]int = make(map[string]map[int]int);

	for i:=0; i < len(input); i++ {
		letterDB[ string(input[i]) ] = make(map[int]int);
	}

	// fmt.Println(letterDB);

	input = input + " "
	for patternLength, i:= 1, 0; i < len(input) - 1; i++ {
		if input[i] == input[i+1] {
			patternLength += 1;
		} else {

			if _, ok := letterDB[string(input[i])][patternLength]; ok {
				letterDB[string(input[i])][patternLength] += 1;
			} else {
				letterDB[string(input[i])][patternLength] = 1;
			}

			patternLength = 1;

		}
	}

	// fmt.Println(letterDB);

	var rankDB map[string]int = make(map[string]int);

	for letter := range letterDB {
		var rank int = 0;
		for patternLength, count := range letterDB[letter] {
			rank += (patternLength/k) * count;
		}
		rankDB[letter] = rank;
	}

	// fmt.Println(rankDB);

	ranks := make([]int, length);
	for _, val := range rankDB {
		ranks = append(ranks, val);
	}

	_, rank := MinMax(ranks);

	fmt.Println(rank);

}

// func main() {
// 	var length, k int;
// 	var letters string;

// 	fmt.Scanf("%d %d", &length, &k);
// 	fmt.Scanf("%s", &letters);

// 	fmt.Println(length, k, letters);

// 	var letterMap map[int]map[int]int = make(map[int]map[int]int);

// 	for i:= 0; i < len(letters); i += 1 {
// 		letter := int(letters[i]);
// 		letterMap[letter] = make(map[int]int);
// 	}

// 	fmt.Println("lk\n");

// 	for i, patternLength := 0, 0; i < len(letters); i += 1 {

// 		fmt.Println(i);

// 		if letters[i] == letters[i+1] {
// 			patternLength += 1
// 			// fmt.Println(patternLength);
// 		} else if val, ok := letterMap[i][patternLength]; ok {
// 			fmt.Println("kj", val);
// 			letterMap[i][patternLength] = val + 1;
// 		} else {
// 			fmt.Println("sk");
// 			letterMap[i][patternLength] = 1;
// 		}
// 	}

// 	fmt.Println(letterMap);
// }


One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

Print a single integer — the number of problems the friends will implement on the contest.

NoteIn the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, ans int
	fmt.Fscanf(reader, "%d\n", &n)
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &c)
		if a+b+c >= 2 {
			ans++
		}
	}
	fmt.Printf("%d", ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	input := bufio.NewScanner(os.Stdin)
	hasInput := input.Scan()
	if hasInput == false {
		panic("Number of problems missing")
	}

	_, err := strconv.Atoi(input.Text())

	if err != nil {
		panic("Undefined number passed")
	}

	p := make([][]uint8, 0)

	for input.Scan() {
		elem := strings.Split(input.Text(), " ")

		mutated := []uint8{}
		for _, v := range elem {
			n, err := strconv.ParseInt(v, 10, 8)
			if err != nil {
				panic ("Undefined number in problemset")
			}

			mutated = append(mutated, uint8(n))
		}

		p = append(p, mutated)
	}

	fmt.Println(teamConsensus(p))

}

func teamConsensus(s [][]uint8) int {
	totalSum := 0
	for _, v := range s {
		sum := uint8(0)
		for _, w := range v {
			sum += w
		}

		if sum > 1 {
			totalSum += 1
		}
	}

	return totalSum
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var n uint16
	var u uint16 = 0
	var a, b, c uint8
	fmt.Fscanf(in, "%d\n", &n)
	for i := 0; uint16(i) < n; i++ {
		fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
		if a+b+c >= 2 {
			u++
		}
	}
	fmt.Println(u)
}

package main

import (
	"fmt"
	"io"
	"os"
)

func cf231a(in io.Reader, out io.Writer) {
	var n int
	var a, b, c int
	var total int
	fmt.Fscan(in, &n)
	for n > 0 {
		fmt.Fscan(in, &a, &b, &c)
		if (a == 1 && b == 1) || (c == 1 && b == 1) || (a == 1 && c == 1) {
			total++
		}
		n--
	}

	fmt.Println(total)

}

func main() { cf231a(os.Stdin, os.Stdout) }

package main

import (
	"fmt"
)

func main() {
	var count int
	fmt.Scanf("%d\n", &count)
	var c1, c2, c3 int
	var tasks [][]int
	for i := 0; i < count; i++ {
		fmt.Scanf("%d %d %d\n", &c1, &c2, &c3)
		tasks = append(tasks, []int{c1, c2, c3})
	}

	var res int

	f := func(b []int) int {
		if  (b[0] == 1 && b[1] == 1) ||
			(b[0] == 1 && b[2] == 1) ||
			(b[1] == 1 && b[2] == 1){
			return 1
		}
		return 0
	}

	for _, t := range tasks {
		res += f(t)
	}
	fmt.Println(res)

}

package main

import "fmt"

func main() {
	var n int
	var ans int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		if x+y+z >= 2 {
			ans++
		}
	}
	fmt.Println(ans)

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	solutions := 0
	for i := 0; i < n && scanner.Scan(); i++ {
		answers := answers(scanner.Text())
		if isGood(answers) {
			solutions++
		}
	}

	fmt.Println(solutions)
}

func answers(s string) []int {
	var n []int

	for _, i := range strings.Fields(s) {
		a, err := strconv.Atoi(i)
		if err == nil {
			n = append(n, a)
		}
	}

	return n
}

func isGood(answers []int) bool {
	knownSolutions := 0
	for _, a := range answers {
		if a == 1 {
			knownSolutions++
			if knownSolutions == 2 {
				return true
			}
		}
	}

	return false
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	var lines []string

	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}

	lines = lines[1:] // drop first element of array -> useless

	result := 0
	for _, line := range lines {
		split := strings.Split(line, " ")

		if len(split) != 3 { // three friends
			panic("invalid input")
		}

		succ := 0
		for _, d := range split {
			n, err := strconv.Atoi(d)
			if err != nil {
				panic("invalid input")
			}
			succ += n
		}

		if succ >= 2 { // at least two of them are sure about the solution.
			result++
		}
	}

	fmt.Println(result)
}

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	fmt.Println(parseInputs())
}

func parseInputs() int {
	in := getInput()
	canDo := 0
	for _, v := range in {
		values := strings.Split(v, " ")
		count := 0
		for _, vv := range values {
			if vv == "1" {
				count++
			}
		}
		if count >= 2 {
			canDo++
		}

	}
	return canDo
}

func getInput() []string {
	reader := bufio.NewReader(os.Stdin)
	inputs := []string{}
	l := -1
	current := 0

	for current != l {
		s, err := reader.ReadString('\n')
		if err != nil {
			log.Fatal(err)
		}
		s = strings.TrimRight(s, "\r\n")

		if l == -1 {
			v, err := strconv.Atoi(s)
			if err != nil {
				log.Fatal(err)
			}
			l = v
			continue
		}
		inputs = append(inputs, s)
		current++
	}
	return inputs
}

package main

import (
	"fmt"
)

func main() {
	var n int
  //var a[][]uint8
  var x, z, y uint8
  var probs int
	fmt.Scanf("%d\n", &n)
  for i := 0; i < n; i++ {
    fmt.Scanf("%d %d %d\n", &x, &y, &z)
    //a = append(a, []uint8{x, y, z})
    if( (x==1 && y==1) || (x==1 && z==1) || (z==1 && y==1)){
      probs++
    }
  }
  fmt.Println(probs)

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.Replace(text, "\r\n", "", -1)

	number, _ := strconv.Atoi(text)

	values := []string{}
	amount := 0

	for i := 0; i < number; i++ {
		text, _ = reader.ReadString('\n')
		text = strings.Replace(text, "\r\n", "", -1)
		values = strings.Split(text, " ")

		var cant_fila int = 0
		for _, num_string := range values {
			num, _ := strconv.Atoi(num_string)
			if num != 0 {
				cant_fila++
			}

		}
		if cant_fila >= 2 {
			amount++
		}
	}

	fmt.Println(amount)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var a, b, c int8
	count := 0
	for ; n > 0; n-- {
		fmt.Scan(&a, &b, &c)
		if a+b+c >= 2 {
			count++
		}
	}
	fmt.Print(count)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	count := 0
	for ; n > 0; n-- {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		if x+y+z >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	sum := 0
	for i := 0; i < n; i++ {
		a := 0
		b := 0
		c := 0
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)

		if a+b+c > 1 {
			sum = sum + 1
		}
	}
	fmt.Println(sum)
}

package main

import (
	"fmt"
)

func main() {
	var m, n int
	res := 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		sum := 0
		for j := 0; j < 3; j++ {
			fmt.Scan(&m)
			if m == 1 {
				sum++
			}
			if sum == 2 {
				res++
				sum = 0
			}
		}
	}
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d\n", &T)
	ans := 0
	var a,b,c int
	for i := 0; i < T; i++ {
		fmt.Scanf("%d%d%d\n", &a, &b, &c)
		if a + b + c >= 2{
			ans ++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var totalInput int
	fmt.Scanln(&totalInput)

	reader := bufio.NewReader(os.Stdin)

	solvable := 0

	for i := 0; i < totalInput; i++ {
		text, _ := reader.ReadString('\n')

		repeated := strings.Count(text, "1")
		if repeated > 1 {
			solvable++
		}
	}

	fmt.Println(solvable)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {

	numberOfProblems := scanInt()
	a, b, c, result := 0, 0, 0, 0

	for i := 0; i < numberOfProblems; i++{
		a, b, c = scanInt(), scanInt(), scanInt()
		if a + b + c > 1{
			result++
		}
	}

	printFmt(result)
	close(channelType)
	oWg.Wait()
}

/*********************** I/O ***********************/

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }

package main

import (
	"fmt"
)

func main() {
	var team [3]int
	var n, total int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d %d\n", &team[0], &team[1], &team[2])
		if (team[0] + team[1] + team[2]) >= 2 {
			total++
		}
	}

	fmt.Println(total)
}

package main

import(
	"fmt"
	"os"
)

var nContest int
var desicions [3]int
var solved int = 0

func isSolved() {
	count := 0
	for i := 0; i < 3; i++ {
		fmt.Fscan(os.Stdin, &desicions[i])
	}

	for i := 0; i < len(desicions); i++ {
		count = count + desicions[i]
	}

	if count >= 2 {
		solved+=1
	}
}

func main() {
	fmt.Fscan(os.Stdin, &nContest)
	for nContest > 0 {
		isSolved()
		nContest-=1
	}
	fmt.Println(solved)
}

package main

import "fmt"

func main() {
	var a, b, c, n, k int

	a = 0
	b = 0
	c = 0
	n = 0
	k = 0

	fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		fmt.Scanln(&a, &b, &c)
		if a+b+c > 2 || a+b+c == 2 {
			k++
		}

	}
	fmt.Println(k)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func print(f string, v ...interface{}) { fmt.Fprintf(w, f, v...) }
func scan(f string, v ...interface{})  { fmt.Fscanf(r, f, v...) }

func main() {
	defer w.Flush()
	var n, p, v, t, out int
	scan("%d\n", &n)
	for i := 0; i < n; i++ {
		scan("%d %d %d\n", &p, &v, &t)
		if p+v+t >= 2 {
			out++
		}
	}
	print("%d", out)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	defer writer.Flush()

	var line string
	scanner := bufio.NewScanner(os.Stdin)
	i := 0
	n := 0
	total := 0
	for scanner.Scan() {
		if i == 0 {
			n, _ = strconv.Atoi(scanner.Text())
		} else {
			line = scanner.Text()
			votes := ArrayStringToInt(strings.Split(line, " "))
			if Run(votes[0], votes[1], votes[2]) {
				total++
			}
		}

		if i >= n {
			break
		}
		i++
	}

	printf("%d", total)
}

func Run(a, b, c int) bool {
	if a+b+c >= 2 {
		return true
	}
	return false
}

// Utils

func ArrayStringToInt(t []string) (t2 []int) {
	for _, i := range t {
		j, err := strconv.Atoi(i)
		if err != nil {
			panic(err)
		}
		t2 = append(t2, j)
	}
	return t2
}

package main

import "fmt"

func main() {
	var tries int

	fmt.Scan(&tries)

	var n, m, a int8
	total := 0
	for i := 0; i < tries; i++ {
		fmt.Scan(&n, &m, &a)

		if n+m+a >= 2 {
			total++
		}
	}

	fmt.Println(total)
}

package main

import (
	"fmt"
)

func main() {
  var n int
  var x, z, y uint8
  var probs int
  fmt.Scanf("%d\n", &n)
  for i := 0; i < n; i++ {
      fmt.Scanf("%d %d %d\n", &x, &y, &z)
      if(x+y+z>=2){
         probs++
      }
  }
  fmt.Println(probs)

}

package main

import "fmt"

func sum(ns [3]int8) int8 {
	var s int8
	for _, n := range ns {
		s += n
	}
	return s
}

func main() {
	var n int
	var s int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var t [3]int8
		fmt.Scanf("%d %d %d\n", &t[0], &t[1], &t[2])
		if sum(t) > 1 {
			s++
		}
	}
	fmt.Printf("%d\n", s)
}

package main

import (
	"fmt"
)

var n, a, b, c, ans int

func main() {
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a, &b, &c)
		a += b + c
		if a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

func main() {
	var n, a, b, c int
	fmt.Scanf("%d\n", &n)
	count := 0
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if a+b+c > 1 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main()  {
	var n, p, v, t int
	res := 0
	fmt.Scan(&n)
	for i:=0; i < n; i++{
		fmt.Scanf("\n%d %d %d", &p, &v, &t)
		if p + v + t > 1{
			res++
		}
	}
	fmt.Println(res)
	return
}

// A. Team
/*
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.

This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

Input
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.

Output
Print a single integer — the number of problems the friends will implement on the contest.

Examples
Input
3
1 1 0
1 1 1
1 0 0

Output
2

Input
2
1 0 0
0 1 1

Output
1

Note
In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it.

In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.
*/
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d ", &n)

	total := 0
	for ; n > 0; n-- {
		var a, b, c int
		fmt.Scanf("%d %d %d ", &a, &b, &c)

		if a+b+c >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

package main

import (
	"fmt"
)

func main() {
	var n, a, b, c, rez, sum int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b, &c)
		rez += a + b + c
		if rez >= 2 {
			sum++
		}
		rez = 0
	}
	fmt.Print(sum)
}

package main

import "fmt"

func main() {
	var n int
	var ans int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		if x+y+z >= 2 {
			ans++
		}
	}
	fmt.Println(ans)

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var n int
	var arr [3]int
	scanf("%d\n", &n)
	ans := 0
	for n > 0 {
		count := 0
		for i := 0; i < 3; i++ {
			scanf("%d", &arr[i])
			if arr[i] > 0 {
				count++
			}
		}
		scanf("\n")
		if count > 1 {
			ans++
		}
		n--
	}

	printf("%d\n", ans)
}

package main

import "fmt"

func main() {
	var n, res int
	fmt.Scanf("%d\n", &n)
	res = 0
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d%d%d\n", &a, &b, &c)
		if a + b + c >= 2 {
			res = res + 1
		}
	}
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var n int
	var a, b, c int
	var total int

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b, &c)
		if a+b+c >= 2 {
			total++
		}
	}

	fmt.Println(total)

}

package main

import "fmt"

func main() {
	var n int
	var p int
	var v int
	var t int
	var number int

	fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&p, &v, &t)
		if p + v + t >= 2 {
			number++
		}
	}
	fmt.Println(number)
}

package main

import "fmt"

func main() {
	var a, b, c, n, k int

	a = 0
	b = 0
	c = 0
	n = 0
	k = 0

	fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		fmt.Scanln(&a, &b, &c)
		if a+b+c > 2 || a+b+c == 2 {
			k++
		}

	}
	fmt.Println(k)
}

package main

import "fmt"

func main() {
	var i int
	_, err := fmt.Scanf("%d\n", &i)
	if err != nil {
		panic(err)
	}

	r := 0
	for cpt := 0; cpt < i; cpt++ {
		var a, b, c int
		_, err = fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if err != nil {
			panic(err)
		}

		if a+b+c >= 2 {
			r++
		}

	}
	fmt.Println(r)

}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	count := 0
	for i, a, b, c := 0, 0, 0, 0; i < n; i++ {
		fmt.Scanln(&a, &b, &c)
		if a + b + c >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var ln, a, b, c, TackPartIn int
	fmt.Scanln(&ln)
	for i := 0; i < ln; i++ {
		fmt.Scanln(&a, &b, &c)
		if a+b+c >= 2 {
			TackPartIn++
		}
	}
	fmt.Println(TackPartIn)
}

package main

import "fmt"

func main() {
	var m, num int
	fmt.Scanf("%d\n", &m)

	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Scanf("%d %d %d\n", &x, &y, &z)
		if (z + y + x) > 1 {
			num++
		}

	}
	fmt.Println(num)

}

package main

import (
	"fmt"
)

var n, a, b, c, ans int

func main() {
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a, &b, &c)
		a += b + c
		if a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func nextWords(scanner *bufio.Scanner) []string {
	scanner.Scan()
	return strings.Fields(scanner.Text())
}

func nextNumbers(scanner *bufio.Scanner) []int {
	var numbers = make([]int, 0)
	line := nextWords(scanner)
	for i:= range line {
		n, _ := strconv.Atoi(line[i])
		numbers = append(numbers, n)
	}
	return numbers
}

func sumInputs(numbers []int) int {
	var sum int
	for i := range numbers {
		sum += numbers[i]
	}
	return sum
}

func nextLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	n, _ := strconv.Atoi(nextLine(scanner))

	var result = 0

	if n > 0 {
		for i:= 0; i < n; i++ {
			numbers := nextNumbers(scanner)
			if sumInputs(numbers) > 1 {
				result++
			}
		}
	}

	fmt.Println(result)
}

package main

import (
	"fmt"
)

func main() {
  var n int
  var x, z, y uint8
  var probs int
  fmt.Scanf("%d\n", &n)
  for i := 0; i < n; i++ {
      fmt.Scanf("%d %d %d\n", &x, &y, &z)
      if(x+y+z>=2){
         probs++
      }
  }
  fmt.Println(probs)

}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	solution := 0
	for i := 0; i < n; i++ {
		var u, v, w int
		fmt.Scan(&u, &v, &w)
		if u+v+w >= 2 {
			solution += 1
		}
	}

	fmt.Print(solution)
}

package main
import "fmt"
func main() {
	var tries, n, m, a int
	fmt.Scan(&tries)
	total := 0
	for i := 0; i < tries; i++ {
		fmt.Scan(&n, &m, &a)

		if n+m+a >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

package main

import "fmt"

func main() {
    var N, t int
    fmt.Scan(&N)
    res := 0
    for i := 0; i < N; i++ {
        val := 0
        for friend := 0; friend < 3; friend++ {
            fmt.Scan(&t)
            val += t
        }
        if val >= 2 {
            res += 1
        }
    }
    fmt.Println(res)
}

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;
	fmt.Scan(&n)
	var c int
	for i := 0 ; i < n ; i++ {
		fmt.Scan(&p,&v,&t)
		if (p+v+t) >= 2 {
			c++
		}
	}
	fmt.Printf("%d\n",c)

}

package main

import "fmt"

func main() {
    var n int
    var a, b, c int
    var result int = 0

    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a, &b, &c)
        if a + b + c >= 2 {
            result++
        }
    }
    fmt.Println(result)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	solutionArray := takeInput()
	validSolutions := checkValidSolutions(solutionArray)
	fmt.Println(validSolutions)
}

func takeInput() []string {
	var solutionArray []string

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < n; i++ {
		scanner.Scan()
		solutionArray = append(solutionArray, scanner.Text())
	}
	return solutionArray
}

func checkValidSolutions(solutions []string) int {
	var validSolutions int
	for i := 0; i < len(solutions); i++ {
		if strings.Count(solutions[i], "1") > 1 {
			validSolutions++
		}
	}
	return validSolutions
}

package main

import "fmt"

func main() {
	var n int
	var a, b, c int
	var total int

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b, &c)
		if a+b+c >= 2 {
			total++
		}
	}

	fmt.Println(total)

}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)
	ans := 0
	for i := 0; i < t; i++ {
		count := 0
		for j := 0; j < 3; j++ {
			var a int
			fmt.Scan(&a)
			count = count + a
		}
		if count >= 2 {
			ans = ans + 1
		}
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var n uint16
	var u uint16 = 0
	var a, b, c uint8
	fmt.Fscanf(in, "%d\n", &n)
	for i := 0; uint16(i) < n; i++ {
		fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
		if a+b+c >= 2 {
			u++
		}
	}
	fmt.Println(u)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	count := 0
	for i, a, b, c := 0, 0, 0, 0; i < n; i++ {
		fmt.Scanln(&a, &b, &c)
		if a + b + c >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	if err := run(os.Args[1:]); err != nil {
	  fmt.Println(err)
	}
}

var CRLFReplacer = strings.NewReplacer("\n", "", "\r", "")

func run(args []string) error {
	reader := bufio.NewReader(os.Stdin)

	text, err := reader.ReadString('\n')
	if err != nil {
		return err
	}
	text = CRLFReplacer.Replace(text)

	lines, err := strconv.Atoi(text)
	if err != nil {
		return err
	}

	problems := 0

	for i := 0; i < lines; i++ {
		text, err := reader.ReadString('\n')
		if err != nil {
			return err
		}
		text = CRLFReplacer.Replace(text)

		parts := strings.Split(text, " ")
		agree := 0
		for _, v := range parts {
			if v == "1" {
				agree++
			}
		}
		if agree >= 2 {
			problems++
		}
	}

	fmt.Println(problems)
	return nil
}

package main

import (
	"fmt"
	"os"
)

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

func scanf(format string, x ...interface{}) {
	if _, err := fmt.Fscanf(os.Stdin, format, x...); err != nil {
		panic(err)
	}
}

func main() {
	var n int
	scanf("%d\n", &n)
	var ans int
	for i := 0; i < n; i++ {
		var a, b, c int
		scanf("%d%d%d\n", &a, &b, &c)
		if a+b+c >= 2 {
			ans++
		}
	}
	printf("%d\n", ans)
}

package main

import (
	"fmt"
)

func main() {
	var n, p, v, t, buf int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanln(&p, &v, &t)
		if p+v+t >= 2 {
			buf += 1
		}
	}
	fmt.Println(buf)
}

package main

import "fmt"

func main() {
	var n, pet, vas, ton, count int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&pet)
		fmt.Scan(&vas)
		fmt.Scan(&ton)

		if (pet == 1 && vas == 1) || (pet == 1 && ton == 1) || (vas == 1 && ton == 1) {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main() {
  var n int
  var x, z, y uint8
  var probs int
  fmt.Scanf("%d\n", &n)
  for i := 0; i < n; i++ {
      fmt.Scanf("%d %d %d\n", &x, &y, &z)
      if(x+y+z>=2){
         probs++
      }
  }
  fmt.Println(probs)

}

package main

import "fmt"

func main() {
	var tries int

	fmt.Scan(&tries)

	var n, m, a int8
	total := 0
	for i := 0; i < tries; i++ {
		fmt.Scan(&n, &m, &a)

		if n+m+a >= 2 {
			total++
		}
	}

	fmt.Println(total)
}

package main

import (
	"fmt"
)

func main() {
	var n, input int
	ind1, tot := 0, 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scan(&input)
			if input == 1 {
				ind1 += 1
			}
		}
		if ind1 >= 2 {
			tot += 1
		}
		ind1 = 0
	}
	fmt.Print(tot)
}

package main

import "fmt"

func main() {
	var ln, a, b, c, TackPartIn int
	fmt.Scanln(&ln)
	for i := 0; i < ln; i++ {
		fmt.Scanln(&a, &b, &c)
		if a+b+c >= 2 {
			TackPartIn++
		}
	}
	fmt.Println(TackPartIn)
}

package main

import (
	"fmt"
)

func main() {
	var team [3]int
	var n, total int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d %d\n", &team[0], &team[1], &team[2])
		if (team[0] + team[1] + team[2]) >= 2 {
			total++
		}
	}

	fmt.Println(total)
}

package main
import "fmt"
func main() {
	var tries, n, m, a int
	fmt.Scan(&tries)
	total := 0
	for i := 0; i < tries; i++ {
		fmt.Scan(&n, &m, &a)

		if n+m+a >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

package main

import "fmt"

func main() {
	var n int

	result := 0

	fmt.Scanf("%d\n", &n)

	var a, b, c int

	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if a + b + c >= 2 {
			result++
		}
	}

	fmt.Print(result)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
	writer *bufio.Writer
)

func init() {
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
}
func scanf(format string, args ...interface{}) (int, error) {
	return fmt.Fscanf(reader, format, args...)
}

func printf(format string, args ...interface{}) (int, error) {
	return fmt.Fprintf(writer, format, args...)
}

func main() {
	defer writer.Flush()
	var n int
	scanf("%d\n", &n)

	arr := make([][]int, n)
	answer := 0
	for i := 0; i < n; i++ {
		arr[i] = make([]int, 3)
		scanf("%d %d %d\n", &arr[i][0], &arr[i][1], &arr[i][2])
		if arr[i][0]+arr[i][1]+arr[i][2] > 1 {
			answer++
		}
	}
	printf("%d", answer)

}

package main

import "fmt"

func main() {
	var n int
	var ans int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		if x+y+z >= 2 {
			ans++
		}
	}
	fmt.Println(ans)

}

package main

import "fmt"

func main() {
	var n int
	var f, s, t int
	solves := 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&f, &s, &t)
		v := f<<2 + s<<1 + t
		if v >= 5 || v == 3 { // 1 1 1 / 1 1 0 / 1 0 1 / 0 1 1
			solves += 1
		}
	}
	fmt.Println(solves)
}

package main
import "fmt"

func main(){
	// your code goes here
	var n int
	fmt.Scan(&n)
	count := 0
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		if a + b + c >= 2 {
			count += 1
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main(){

	var numberOfRows int = 0
	_,_ = fmt.Scanln(&numberOfRows)

	var twoDMatrix = make([][3]int,numberOfRows)

	for i:=0; i<numberOfRows; i++ {
		for j:=0; j<3; j++ {
			_,_ = fmt.Scan(&twoDMatrix[i][j])
		}
	}

	var count int = 0
	for i:=0; i<numberOfRows; i++ {
		temp := 0
		for j:=0; j<3; j++ {
			if twoDMatrix[i][j] == 1 {
				temp++
			}
		}
		if temp > 1 {
			count++
		}
	}

	fmt.Println(count)

}

package main

import (
	"fmt"
)

func main() {
	// take inputs
	// for each line
	// add friends' certainties.
	// bump count -> if <1 false, else true
	// return count

	// 1 <= numProblems <= 1000, so the default int32 is okay.
	numProblems := 0
	fmt.Scanln(&numProblems)
	// fmt.Printf("solving: %d problems\n", numProblems)

	implemented := 0
	for numProblems > 0 {
		a := 0
		b := 0
		c := 0
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		// fmt.Printf("a,b,c: %d,%d,%d\n", a, b, c)

		// should we implement?
		if (a + b + c) >= 2 {
			implemented++
		}
		/*
			count := 0
			for _, certain := range strings.Split(line, ",") {
				if num, _ := strconv.Atoi(certain); num > 2 {
					count++
				}
			}
			if count >= 2 {
				fmt.Printf("%d/3 are cetain, implementing!\n", count)
				implemented++
			}
		*/
		numProblems--
	}
	fmt.Println(implemented)
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d\n", &T)
	ans := 0
	var a,b,c int
	for i := 0; i < T; i++ {
		fmt.Scanf("%d%d%d\n", &a, &b, &c)
		if a + b + c >= 2{
			ans ++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import (
	"fmt"
)

var n, a, b, c, ans int

func main() {
	fmt.Scanf("%d\n", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d%d%d\n", &a, &b, &c)
		a += b + c
		if a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

func main() {
	var n int
	result := 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		if a+b+c > 1 {
			result++
		}
	}
	fmt.Println(result)
}

package  main
import ("fmt")

func main(){
	var x ,y,z,n int
	fmt.Scan(&n);
	c:=0
	for i:=0;i<n;i++{
		//fmt.Scanf("%d %d %d\n",&x,&y,&z)

		fmt.Scan(&x);
		fmt.Scan(&y);
		fmt.Scan(&z);

		var ad = x+y+z
		//fmt.Print(ad)
		if(ad>=2){
			c++
		}
	}
	fmt.Print(c)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var n uint16
	var u uint16 = 0
	var a, b, c uint8
	fmt.Fscanf(in, "%d\n", &n)
	for i := 0; uint16(i) < n; i++ {
		fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
		if a+b+c >= 2 {
			u++
		}
	}
	fmt.Println(u)
}

/* https://codeforces.com/problemset/problem/231/A
A. Team
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.

This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

Input
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.

Output
Print a single integer — the number of problems the friends will implement on the contest.

Examples
inputCopy
3
1 1 0
1 1 1
1 0 0
outputCopy
2
inputCopy
2
1 0 0
0 1 1
outputCopy
1
Note
In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it.

In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.
*/

package main

import "fmt"

func main() {
	var number_of_input_lines, surity int
	fmt.Scanf("%d\n", &number_of_input_lines)

	number_of_input_lines_for_slice := number_of_input_lines + 1

	var problems_slice []int

	mathtesting := 0
	for i := 1; i < number_of_input_lines_for_slice; i++ {
		//	for i, _ := range problems_slice {
		var petya, vasya, tonya int
		fmt.Scanf("%d %d %d\n", &petya, &vasya, &tonya)

		mathtesting = petya + vasya + tonya
		problems_slice = append(problems_slice, mathtesting)
	}

	for _, value := range problems_slice {
		if value >= 2 {
			surity = surity + 1
		}
	}

	fmt.Println(surity)
}

package main

import (
        "fmt"
)

func main() {
        var (
                inputnum int
                input1   int
                input2   int
                input3   int
        )
        fmt.Scan(&inputnum)
        output := 0
        for i := 0; i < inputnum; i++ {
                fmt.Scan(&input1, &input2, &input3)
                if input1+input2+input3 >= 2 {
                        output += 1
                }
        }
        fmt.Println(output)
}

package main

import "fmt"

func main() {
    var N, t int
    fmt.Scan(&N)
    var cnt [1005]int
    for friend := 0; friend < 3; friend++ {
        for i := 0; i < N; i++ {
            fmt.Scan(&t)
            cnt[i] += t
        }
    }
    res := 0
    for _, number := range cnt {
        if number >= 2 {
            res += 1
        }
    }
    fmt.Println(res)
}

package main

import "fmt"

func main() {
	var amountOfProblems, problemsImplemented int
	problemsImplemented = 0
	fmt.Scanf("%d", &amountOfProblems)
	for i := 0; i < amountOfProblems; i++ {
		var friend1, friend2, friend3 int
		fmt.Scanf("%d %d %d\n", &friend1, &friend2, &friend3)
		if friend1+friend2+friend3 >= 2 {
			problemsImplemented++
		}
	}
	fmt.Println(problemsImplemented)
}

package main

import "fmt"

func main() {
	var amountOfProblems, problemsImplemented int
	problemsImplemented = 0
	fmt.Scanf("%d", &amountOfProblems)
	for i := 0; i < amountOfProblems; i++ {
		friend1, friend2, friend3 := 0, 0, 0
		fmt.Scanf("%d %d %d\n", &friend1, &friend2, &friend3)
		if friend1+friend2+friend3 == 2 || friend1+friend2+friend3 == 3 {
			problemsImplemented++
		}
	}
	fmt.Println(problemsImplemented)
}

package main

import "fmt"

func main() {
	var amountOfProblems, problemsImplemented int
	problemsImplemented = 0
	fmt.Scanf("%d", &amountOfProblems)
	for i := 0; i < amountOfProblems; i++ {
		var friend1, friend2, friend3 int
		fmt.Scanf("%d %d %d\n", &friend1, &friend2, &friend3)
		if friend1+friend2+friend3 == 2 || friend1+friend2+friend3 == 3 {
			problemsImplemented++
		}
	}
	fmt.Println(problemsImplemented)
}

package main

import "fmt"

func main() {
	var amountOfProblems, problemsImplemented int
	problemsImplemented = 0
	fmt.Scanf("%d", &amountOfProblems)
	for i := 0; i < amountOfProblems; i++ {
		var friend1, friend2, friend3 int
		fmt.Scanf("%d %d %d", &friend1, &friend2, &friend3)
		if friend1+friend2+friend3 == 2 || friend1+friend2+friend3 == 3 {
			problemsImplemented++
		}
	}
	fmt.Println(problemsImplemented)
}

package main

import "fmt"

func main() {
	var m, num int
	fmt.Scanf("%d", &m)

	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Scanf("%d %d %d", &x, &y, &z)
		if (z + y + x) > 1 {
			num++
		}

	}
	fmt.Println(num)

}

package main

import "fmt"

func main() {
	var m int
	fmt.Scanf("%d", &m)
	var num int
	i := 1
	for i <= m {
		var a, b, c int
		fmt.Scanf("%d %d %d", &a, &b, &c)
		if (a + b + c) > 1 {
			num++
		}

		i++
	}
	fmt.Println(num)

}

package main

import "fmt"

func main() {
    var n int;
    petya, vasya, tonya, counter := 0,0,0,0
    fmt.Scanf("%d", &n)
    for i :=0; i < n; i++ {
      fmt.Scanf("%d %d %d", &petya, &vasya, &tonya)
      if petya + vasya + tonya >= 2 {
              counter++
      }
    }
    fmt.Print(counter)
}

package main

import "fmt"

func main() {
	var n int
	petya, vasya, tonya, counter := 0, 0, 0, 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d %d", &petya, &vasya, &tonya)
		if petya+vasya+tonya >= 2 {
			counter++
		}
	}
	fmt.Print(counter)
}

package main

import "fmt"

var n, a, b, c, ans int

func main() {
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d%d%d", &a, &b, &c)
		a += b
		a += c
		if a >= 2 {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

var n, a, b, c, ans int

func main() {
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d %d %d", &a, &b, &c)
		a += b
		a += c
		if a >= 2 {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var n, ans int
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		var a, b, c int
		fmt.Scanf("%d%d%d", &a, &b, &c)
		a = a + b
		a = a + c
		if a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

func main() {
	var n, a, b, c, ans int
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d%d%d", &a, &b, &c)
		a += b
		a += c
		if a >= 2 {
			ans++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

var n, a, b, c, ans int

func main() {
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d%d%d", &a, &b, &c)
		a += b + c
		if a >= 2 {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	sum := 0
	for i := 0; i < n; i++ {
		var p, q, r int
		fmt.Scanf("%d %d %d", &p, &q, &r)
		if (p + q + r) >= 2 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	sum := 0
	for i := 0;i < n; i++ {
		var p, q, r int
		fmt.Scanf("%d %d %d", &p, &q, &r)
		if (p + q + r) >= 2 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main
import (
		"fmt"
		"strings"
		)

func main() {
	var input string
	fmt.Scan(&input)
	input = strings.ToLower(input)
	for i := 0; i < len(input); i++ {
		ch := input[i]
		if ch == 'a' || ch == 'o' || ch == 'y' || ch == 'e' || ch == 'u' || ch == 'i' {
			continue
		} else {
			fmt.Printf(".%c", ch)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	sum := 0
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d", &a)
		fmt.Scanf("%d", &b)
		fmt.Scanf("%d", &c)

		if a+b+c > 1 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	// reader := bufio.NewReader(os.Stdin)
	var n int
	var input string
	fmt.Scanln(&input)
	n, _ = strconv.Atoi(input)

	sum := 0
	for i := 0; i < n-1; i++ {
		fmt.Scanln(&input)
		s := strings.Split(input, " ")
		a, _ := strconv.Atoi(s[0])
		fmt.Scanln(&input)
		s = strings.Split(input, " ")
		b, _ := strconv.Atoi(s[0])
		fmt.Scanln(&input)
		s = strings.Split(input, " ")
		c, _ := strconv.Atoi(s[0])

		if a+b+c > 1 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	sum := 0
	for i := 0; i < n; i++ {
		a := 0
		b := 0
		c := 0
		fmt.Scanf("%d", &a)
		fmt.Scanf("%d", &b)
		fmt.Scanf("%d", &c)

		if a+b+c > 1 {
			sum = sum + 1
		}
	}
	fmt.Println(sum)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	sum := 0
	for i := 0; i < n; i++ {
		a := 0
		b := 0
		c := 0
		fmt.Scanf("%d", &a)
		fmt.Scanf("%d", &b)
		fmt.Scanf("%d", &c)

		if a+b+c > 1 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var input string
	fmt.Scanln(&input)
	n, _ = strconv.Atoi(input)

	sum := 0
	for i := 0; i < n; i++ {
		input, _ = reader.ReadString('\n')
		input = strings.Replace(input, "\n", "", -1)
		// fmt.Scanln(&input)
		s := strings.Split(input, " ")
		a, _ := strconv.Atoi(s[0])
		// fmt.Scanln(&input)
		// s = strings.Split(input, " ")
		b, _ := strconv.Atoi(s[1])
		// fmt.Scanln(&input)
		// s = strings.Split(input, " ")
		c, _ := strconv.Atoi(s[2])

		// fmt.Println("a, b, c:", a+b+c)
		if a+b+c > 1 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var input string
	fmt.Scanln(&input)
	n, _ = strconv.Atoi(input)

	sum := 0
	for i := 0; i < n; i++ {
		input, _ = reader.ReadString('\n')
		// input = strings.Replace(input, "\n", "", -1)
		// fmt.Scanln(&input)
		s := strings.Split(input, " ")
		a, _ := strconv.Atoi(s[0])
		// fmt.Scanln(&input)
		// s = strings.Split(input, " ")
		b, _ := strconv.Atoi(s[1])
		// fmt.Scanln(&input)
		// s = strings.Split(input, " ")
		c, _ := strconv.Atoi(s[2])

		// fmt.Println("a, b, c:", a+b+c)
		if a+b+c > 1 {
			sum++
		}
	}
	fmt.Println(sum)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	res := 0
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d%d%d", &a, &b, &c)
		if a + b + c >= 2 {
			res++
		}
	}
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func main() {
	var m, n int
	res := 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		sum := 0
		for j := 0; j < 3; j++ {
			fmt.Scan(&m)
			if m == 1 {
				sum++
			}
			if sum == 2 {
				res++
			}
		}
	}
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	solution := 0
	for i := 0; i < n; i++ {
		var u, v, w int
		fmt.Scanf("%d %d %d", &u, &v, &w)
		if u+v+w >= 2 {
			solution += 1
		}
	}

	fmt.Print(solution)
}

package main

import "fmt"

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	s := 0
	for i := 0; i < n; i++ {
		var p, v, t int
		_, _ = fmt.Scanln(&p, &v, &t)
		if p+v+t >= 2 {
			s += 1
		}
	}
	fmt.Print(s)
}

package main

import "fmt"

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	s := 0
	for i := 0; i < n; i++ {
		var p, v, t int
		_, _ = fmt.Scanln(&p, &v, &t)
		if p+v+t >= 2 {
			s += 1
		}
	}
	fmt.Println(s)
}

package main

import "fmt"

func main() {
	var i int
	_, err := fmt.Scanf("%d\n", &i)
	if err != nil {
		panic(err)
	}

	for cpt := 0; cpt < i; cpt++ {
		var a, b, c int
		_, err = fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if err != nil {
			panic(err)
		}

		// judging system bugs
		//r := 0

		if a+b+c >= 2 {
			//r++
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}

		//fmt.Println(r)

	}

}

package main

import "fmt"

func main() {
	var i int
	_, err := fmt.Scanf("%d\n", &i)
	if err != nil {
		panic(err)
	}

	for cpt := 0; cpt < i; cpt++ {
		var a, b, c int
		_, err = fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if err != nil {
			panic(err)
		}

		r := 0

		if a+b+c >= 2 {
			r++
		}

		fmt.Println(r)

	}

}

package  main
import ("fmt")

func main(){
	var x,y,z,n int
	fmt.Scan(&n);
	c:=0
	for i:=0;i<n;i++{
		fmt.Scanf("%d %d %d",&x,&y,&z)

		var ad = x+y+z
		if(ad>=2){
			c++
		}
	}
	fmt.Print(c)
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d", &T)
	ans := 0
	for i := 0; i < T; i++ {
		var a,b,c int
		fmt.Scanf("%d%d%d", &a, &b, &c)
		if a + b + c >= 2{
			ans ++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d\n", &T)
	ans := 0
	for i := 0; i < T; i++ {
		var a,b,c int
		fmt.Scanf("%d%d%d", &a, &b, &c)
		if a + b + c >= 2{
			ans ++
		}
	}
	fmt.Printf("%d\n", ans)
}

package main

import (
        "fmt"
)

func main() {
        var (
                inputnum int
                input1   int
                input2   int
                input3   int
        )
        fmt.Scanf("%d", &inputnum)
        var output int
        for i := 0; i < inputnum; i++ {
                fmt.Scanf("%d %d %d", &input1, &input2, &input3)
                if input1+input2+input3 >= 2 {
                        output += 1
                }
        }
        fmt.Println(output)
}

package main

import (
        "fmt"
)

func main() {
        var (
                inputnum int
                input1   int
                input2   int
                input3   int
        )
        fmt.Scanf("%d", &inputnum)
        output := 0
        for i := 0; i < inputnum; i++ {
                fmt.Scanf("%d %d %d", &input1, &input2, &input3)
                if input1+input2+input3 >= 2 {
                        output += 1
                }
        }
        fmt.Println(output)
}

package main

import (
        "fmt"
)

func main() {
        var inputnum int
        fmt.Scanf("%d", &inputnum)
        output := 0
        for i := 0; i < inputnum; i++ {
                var (
                        input1 int
                        input2 int
                        input3 int
                )
                fmt.Scanf("%d %d %d", &input1, &input2, &input3)
                if input1+input2+input3 >= 2 {
                        output += 1
                }
        }
        fmt.Println(output)
}

package main

import "fmt"

func main() {
    var n int
    var a, b, c int
    var result int = 0

    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%d %d %d\n", &a, &b, &c)
        if a + b + c >= 2 {
            result++
        }
    }
    fmt.Println(result)
}

package main

import "fmt"

func main() {
	var seccess int
	var count int
	fmt.Scan(&count)
	var a,b,c int
	for i := 0; i < count; i++ {
		fmt.Scanf("%d %d %d\n",&a, &b, &c)
		if a+b+c >=2 {
			seccess++
		}
	}
	fmt.Println(seccess)
}

package main

import (
	"fmt"
)

func main()  {
	var n, p, v, t int
	res := 0
	fmt.Scan(&n)
	for i:=0; i < n; i++{
		fmt.Scanf("%d %d %d", &p, &v, &t)
		if p + v + t > 1{
			res++
		}
	}
	fmt.Println(res)
	return
}

package main

import (
	"fmt"
)

func main()  {
	var n, p, v, t int
	res := 0
	fmt.Scan(&n)
	for i:=0; i < n; i++{
		fmt.Scanf("%d %d %d", &p, &v, &t)
		if p + v + t >= 2{
			res++
		}
	}
	fmt.Println(res)
	return
}

package main

import (
	"fmt"
)

func main() {
	var n, input int
	ind1, tot := 0, 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scan(&input)
			if input == 1 {
				ind1 += 1
			}
		}
		if ind1 >= 2 {
			tot += 1
			ind1 = 0
		}
	}
	fmt.Print(tot)
}

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	c := 0
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) > 1 {
			c++
		}
	}
	fmt.Printf("%d\n",c)

}

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	var c int
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) >= 2 {
			c++
		}
	}
	fmt.Printf("%d\n",c)

}

// func Compt{
// 	reader := bufio.NewReader(os.Stdin)
// 	city,_:= reader.ReadInteger('\n')
// 	var n int
// 	fmt.Scanf("%d",&n)
// 	var ar = make([]int,n)
// 	for i := 0 ; i < n ; i++ {
// 		fmt.Scanf("%d",&ar[i])
// 	}
// 	for _,el := range ar{
// 		fmt.Println(el)
// 	}
// }
// func ScanArr(n int) []int{
// 	var ar = make([]int,n)
// 	for i:= 0 ; i < n ; i++{
// 		fmt.Scanf("%d",&ar[i])
// 	}
// 	return ar
// }

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	c := 0
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) > 1 {
			c++
		}
	}
	fmt.Printf("%d\n",c)

}

// func Compt{
// 	reader := bufio.NewReader(os.Stdin)
// 	city,_:= reader.ReadInteger('\n')
// 	var n int
// 	fmt.Scanf("%d",&n)
// 	var ar = make([]int,n)
// 	for i := 0 ; i < n ; i++ {
// 		fmt.Scanf("%d",&ar[i])
// 	}
// 	for _,el := range ar{
// 		fmt.Println(el)
// 	}
// }
// func ScanArr(n int) []int{
// 	var ar = make([]int,n)
// 	for i:= 0 ; i < n ; i++{
// 		fmt.Scanf("%d",&ar[i])
// 	}
// 	return ar
// }

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	c := 0
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) > 1 {
			c += 1
		}
	}
	fmt.Printf("%d\n",c)

}

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	c := 0
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) >= 2 {
			c += 1
		}
	}
	fmt.Println(c)

}

package main

import (
	"fmt"
)

func main() {

	var n , p , v , t int ;

	fmt.Scanf("%d",&n)
	c := 0
	for i := 0 ; i < n ; i++ {
		fmt.Scanf("%d %d %d",&p,&v,&t)
		if (p+v+t) >= 2 {
			c += 1
		}
	}
	fmt.Printf("%d\n",c)

}

// 9.Codeforce 231A-Michael542
package main

import (
    "fmt"
)

func main() {
    var n, a, can, cou int
    fmt.Scanf("%d", &n)
    for x := 0; x < n; x++ {
        for y:= 0; y < 3; y++ {
            fmt.Scanf("%d", &a )
            if a == 1 {
                can++
            }
        }
        if can >=2 {
            cou++
        }
        can = 0
    }
    fmt.Println(cou)
    cou = 0
}

// 9.Codeforce 231A-Michael542
package main

import (
    "fmt"
)

func main() {
    var n, p, v, t, can, cou int
    fmt.Scanf("%d", &n)
    for x := 0; x < n; x++ {
        fmt.Scanf("%d %d %d", &p, &v, &t)
        if p == 1 {
            can++
        }
        if v == 1 {
            can++
        }
        if t == 1 {
            can++
        }
        if can >=2 {
            cou++
        }
        can = 0
    }
    fmt.Println(cou)
}

package main

import (
    "fmt"
)

func main() {
    var n, p, v, t, can, cou int
    fmt.Scanf("%d", &n)
    for x := 0; x < n; x++ {
        fmt.Scanf("%d %d %d", &p, &v, &t)
        if p == 1 {
            can++
        }
        if v == 1 {
            can++
        }
        if t == 1 {
            can++
        }
        if can >=2 {
            cou++
        }
        can = 0
    }
    fmt.Println(cou)
}

package main

import "fmt"

func main() {
	var testcount, a, b, c, count int
	fmt.Scanf("%d", &testcount)
	for i := 0; i < testcount; i++ {
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if a+b+c >= 2 {
			count++
		}
	}
	fmt.Printf("%d", count)
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	ans := 0
	for i := 0; i < t; i++ {
		count := 0
		for j := 0; j < 3; j++ {
			var a int
			fmt.Scanf("%d", &a)
			count = count + a
		}
		if count >= 2 {
			ans = ans + 1
		}
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	var mat = make([][]int, t)
	ans := 0
	for i := 0; i < t; i++ {
		count := 0
		for j := 0; j < 3; j++ {
			var a int
			fmt.Scanf("%d", &a)
			mat[i] = append(mat[i], a)
			count = count + a
		}
		if count >= 2 {
			ans = ans + 1
		}
	}
	fmt.Println(ans)
}

package main
import "fmt"
func main() {
  var n int
  var result int
  result = 0
  fmt.Scanf("%d",&n)
  for i := 0; i < n; i++ {
    var a, b, c int
    fmt.Scanf("%d %d %d",&a,&b,&c)
    fmt.Printf("== %d %d %d\n",a,b,c)
    if a + b + c >= 2 {
      result++
    }
  }
  fmt.Printf("%d\n",result)
}

package main
import "fmt"
func main() {
  var n int
  var result int
  result = 0
  fmt.Scanf("%d",&n)
  for i := 0; i < n; i++ {
    var a, b, c int
    fmt.Scanf("%d %d %d",&a,&b,&c)
    if a + b + c >= 2 {
      result++
    }
  }
  fmt.Printf("%d\n",result)
}

package main
import "fmt"
func main() {
  var n int
  var result int
//  result := 0
  fmt.Scanf("%d",&n)
  for i := 0; i < n; i++ {
    var a, b, c int
    fmt.Scanf("%d %d %d",&a,&b,&c)
    if a + b + c >= 2 {
      result++
    }
  }
  fmt.Printf("%d\n",result)
}

package main

import "fmt"

func sum(ns [3]int8) int8 {
	var s int8
	for _, n := range ns {
		s += n
	}
	return s
}

func main() {
	var n int
	var s int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var t [3]int8
		fmt.Scanf("%d %d %d", &t[0], &t[1], &t[2])
		if sum(t) > 1 {
			s++
		}
	}
	fmt.Printf("%d\n", s)
}

package main

import (
	"fmt"
)

func main() {
	var N, cnt, inp, que int
	fmt.Scanf("%d\n", &N)

	for i := 0; i < N; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d", &inp)
			if inp == 1 {
				cnt++
			}
		}
		if cnt >= 2 {
			que++
		}
		cnt = 0
		fmt.Println("\n")
	}
	fmt.Println(que)
}

package main

import (
	"fmt"
)

func main() {
	var N, cnt, inp, que int
	fmt.Scanf("%d\n", &N)

	for i := 0; i < N; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d", &inp)
			if inp == 1 {
				cnt++
			}
		}
		if cnt >= 2 {
			que++
		}
		cnt = 0
	}
	fmt.Println(que)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	var stringMatrix []string

	var number uint8
	_, _ = fmt.Scanln(&number)
	for number > 0 {
		myString, _ := bufio.NewReader(os.Stdin).ReadString('\n')
		stringMatrix = append(stringMatrix, myString)
		number--
	}

	var count uint8 = 0

	for _,value := range stringMatrix {

		var vector []int64
		tempArray := strings.Split(value," ")

		for i:=0; i<len(tempArray); i++ {
			temp,_ := strconv.ParseInt(strings.TrimSpace(tempArray[i]),10,64)
			vector = append(vector,temp)
		}
		var temp uint8
		for i:=0; i<len(vector); i++ {
			if vector[i] == 1 {
				temp++
			}
		}

		if temp > 1 {
			count++
		}

	}

	fmt.Printf("%d",count)

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	var stringMatrix []string

	var number uint8
	_, _ = fmt.Scanln(&number)
	for number > 0 {
		myString, _ := bufio.NewReader(os.Stdin).ReadString('\n')
		stringMatrix = append(stringMatrix, myString)
		number--
	}

	var count uint8 = 0

	for _, value := range stringMatrix {

		var vector []int64
		tempArray := strings.Split(value, " ")

		for i := 0; i < len(tempArray); i++ {
			temp, _ := strconv.ParseInt(strings.TrimSpace(tempArray[i]), 10, 64)
			vector = append(vector, temp)
		}
		var temp uint8
		for i := 0; i < len(vector); i++ {
			if vector[i] == 1 {
				temp++
			}
		}

		if temp > 1 {
			count++
		}

	}

	fmt.Printf("%d", count)

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	var stringMatrix []string

	var number uint8
	_, _ = fmt.Scanln(&number)
	for number > 0 {
		myString, _ := bufio.NewReader(os.Stdin).ReadString('\n')
		stringMatrix = append(stringMatrix, myString)
		number--
	}

	var count uint8 = 0

	for _, value := range stringMatrix {

		var vector []int64
		tempArray := strings.Split(value, " ")

		for i := 0; i < len(tempArray); i++ {
			temp, _ := strconv.ParseInt(strings.TrimSpace(tempArray[i]), 10, 64)
			vector = append(vector, temp)
		}
		var temp uint8 = 0
		for i := 0; i < len(vector); i++ {
			if vector[i] == 1 {
				temp++
			}
		}

		if temp > 1 {
			count++
		}

	}

	fmt.Printf("%d", count)

}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	var a, b, c = make([]int, n), make([]int, n), make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	for i := range b {
		fmt.Scan(&b[i])
	}
	for i := range c {
		fmt.Scan(&c[i])
	}
	count := 0
	for i := range a {
		if a[i] + b[i] + c[i] >= 2 {
			count++
		}
	}
	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	total := 0
	for ; n > 0; n-- {
		var a, b, c int
		i, err := fmt.Scanf("%d %d %d", &a, &b, &c)
        fmt.Println(i, err)
        fmt.Println(a, b, c)
		if a+b+c >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d ", &n)

	total := 0
	for ; n > 0; n-- {
		var a, b, c int
		i, err := fmt.Scanf("%d %d %d ", &a, &b, &c)
		fmt.Println("ERR = ",i, err)
		fmt.Println(a, b, c)
		if a+b+c >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

// A. Team
/*
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.

This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

Input
The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.

Output
Print a single integer — the number of problems the friends will implement on the contest.

Examples
Input
3
1 1 0
1 1 1
1 0 0

Output
2

Input
2
1 0 0
0 1 1

Output
1

Note
In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it.

In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.
*/
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	total := 0
	for ; n > 0; n-- {
		var a, b, c int
		fmt.Scanf("%d %d %d", &a, &b, &c)

		if a+b+c >= 2 {
			total++
		}
	}
	fmt.Print(total)
}

package main

import "fmt"

func main() {
	var n int
	var result int

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if a+b+c > 1 {
			result++
		}
	}
	fmt.Println(result)

}

package main

import "fmt"

func main() {
	var n int
	result := 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d %d %d", &a, &b, &c)
		if a+b+c > 1 {
			result++
		}
	}
	fmt.Println(result)
}

package main

import "fmt"

func main() {
	var n, result int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var a, b, c int
		fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if a + b + c >= 2 {
			result++
		}
	}

	fmt.Print(result)
}

package main

import "fmt"

func main() {
	var n, result int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var a, b, c int

		fmt.Scanf("%d %d %d", &a, &b, &c)

		if a + b + c >= 2 {
			result++
		}
	}

	fmt.Print(result)
}

package main

import "fmt"

func main() {
	var n, result int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var a, b, c int

		fmt.Scanf("%d %d %d\n", &a, &b, &c)

		if a + b + c >= 2 {
			result++
		}
	}

	fmt.Print(result)
}


Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in the following form: «employee ai is ready to become a supervisor of employee bi at extra cost ci». The qualification qj of each employee is known, and for each application the following is true: qai > qbi. Would you help Nick calculate the minimum cost of such a hierarchy, or find out that it is impossible to build it.

The first input line contains integer n (1 ≤ n ≤ 1000) — amount of employees in the company. The following line contains n space-separated numbers qj (0 ≤ qj ≤ 106)— the employees' qualifications. The following line contains number m (0 ≤ m ≤ 10000) — amount of received applications. The following m lines contain the applications themselves, each of them in the form of three space-separated numbers: ai, bi and ci (1 ≤ ai, bi ≤ n, 0 ≤ ci ≤ 106). Different applications can be similar, i.e. they can come from one and the same employee who offered to become a supervisor of the same person but at a different cost. For each application qai > qbi.

Output the only line — the minimum cost of building such a hierarchy, or -1 if it is impossible to build it.

NoteIn the first sample one of the possible ways for building a hierarchy is to take applications with indexes 1, 2 and 4, which give 11 as the minimum total cost. In the second sample it is impossible to build the required hierarchy, so the answer is -1.

package main

import (
  "os"
  "bufio"
  "strconv"
  "fmt"
)

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

type Node struct {
  Parent, ParentCost int
  Children map[int]bool
}

func dfs(node *Node) (cost, count int) {
  cost, count = node.ParentCost, 1
  for v := range node.Children {
    costDelta, countDelta := dfs(nodes[v])
    cost += costDelta
    count += countDelta
  }
  return
}

var nodes []*Node

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  n := getI()
  nodes = make([]*Node, n+1)
  for i := 1; i <= n; i++ {
    nodes[i] = &Node{ -1, 0, map[int]bool{} }
  }
  root, qRoot := 1, getI()
  for i := 2; i <= n; i++ {
    q := getI()
    if q > qRoot {
      qRoot = q
      root = i
    }
  }

  m := getI()
  for i := 0; i < m; i++ {
    u, v, cost := getI(), getI(), getI()
    parent, child := nodes[u], nodes[v]
    if child.Parent == -1 || child.ParentCost > cost {
      if child.Parent != -1 {
        delete(nodes[child.Parent].Children, v)
      }
      child.ParentCost = cost
      child.Parent = u
      parent.Children[v] = true
    }
  }

  cost, count := dfs(nodes[root])
  if count != n {
    writer.WriteString("-1\n")
  } else {
    writer.WriteString(fmt.Sprintf("%d\n", cost))
  }
}