import scala.io.StdIn.{readInt,readLine}
import scala.collection.mutable.ArrayBuffer

object Main {
  def isParallel(x1:Double, y1:Double, x2:Double, y2:Double, x3:Double, y3:Double, x4:Double, y4:Double) = {
    val p = (x2-x1)*(y4-y3)-(x4-x3)*(y2-y1)
    if(p < (1e-10) && p > -(1e-10)) true else false
  }

  def isOrthogonal(x1:Double, y1:Double, x2:Double, y2:Double, x3:Double, y3:Double, x4:Double, y4:Double) = {
    val p =  (x2-x1)*(x4-x3)+(y2-y1)*(y4-y3)
    if(p < (1e-10) && p > -(1e-10)) true else false
  }

  def main(args:Array[String]) = {
   val n = readInt
   val b = new ArrayBuffer[Int]

   for(i<-1 to n) {
     val p = readLine.split(" ").map(_.toDouble)
     if(isParallel(p(0),p(1),p(2),p(3),p(4),p(5),p(6),p(7))) b += 2
     else if(isOrthogonal(p(0),p(1),p(2),p(3),p(4),p(5),p(6),p(7))) b += 1
     else b += 0
   }
   println(b.mkString("\n"))
  }
}