#include <cstdio>
#include <algorithm>

double EPS = 1e-9;

// double
struct P{
    P(){}
    P(double _r, double _i):r(_r), i(_i){}
    void real(const double& v){r = v;}
    void imag(const double& v){i = v;}
    double r, i;
};

double real(const P& p){return p.r;}
double imag(const P& p){return p.i;}
double norm(const P& p){double r = real(p), i = imag(p); return r * r + i * i;}
double dist(const P& p){return std::sqrt(norm(p));}

P operator+(const P& lhs, const P& rhs){
    return P(real(lhs)+real(rhs), imag(lhs)+imag(rhs));
}
P operator-(const P& lhs, const P& rhs){
    return P(real(lhs)-real(rhs), imag(lhs)-imag(rhs));
}
P operator-(const P& p){
    return P(-real(p), -imag(p));
}

double cross(const P& lhs, const P& rhs){
    return real(lhs)*imag(rhs) - imag(lhs)*real(rhs);
}

double dot(const P& lhs, const P& rhs){
    return real(lhs)*real(rhs) + imag(lhs)*imag(rhs);
}

bool areIntersectedLines(const P& p1, const P& p2, const P& q1, const P& q2){
    if(cross(p1-p2, q1-p2) == 0 && dot(p1-p2, q1-p2) > 0 &&
       0 <= norm(q1-p2) && norm(q1-p2) <= norm(p1-p2)){
        return true;
    }
    if(cross(p1-p2, q2-p2) == 0 && dot(p1-p2, q2-p2) > 0 &&
       0 <= norm(q2-p2) && norm(q2-p2) <= norm(p1-p2)){
        return true;
    }
    if(cross(q1-q2, p1-q2) == 0 && dot(q1-q2, p1-q2) > 0 &&
       0 <= norm(p1-q2) && norm(p1-q2) <= norm(q1-q2)){
        return true;
    }
    if(cross(q1-q2, p2-q2) == 0 && dot(q1-q2, p2-q2) > 0 &&
       0 <= norm(p2-q2) && norm(p2-q2) <= norm(q1-q2)){
        return true;
    }

    return (cross(p1-p2, q1-p2) * cross(p1-p2, q2-p2) <= 0) &&
        (cross(q1-q2, p1-q2) * cross(q1-q2, p2-q2) <= 0);
}

P intersection(const P& p1, const P& p2, const P& q1, const P& q2){
    P a = p2-p1, b = q2-q1;
    double x = cross(b, q1-p1) / cross(b, a);
    P c{real(a) * x, imag(a) * x};
    return p1 + c;
}

int N;
bool used[25252];
P line[104][2];

int main(){
    line[0][0] = {-100.0, -100.0};
    line[0][1] = {-100.0, 100.0};
    line[1][0] = {-100.0, 100.0};
    line[1][1] = {100.0, 100.0};
    line[2][0] = {100.0, 100.0};
    line[2][1] = {100.0, -100.0};
    line[3][0] = {100.0, -100.0};
    line[3][1] = {-100.0, -100.0};
    
    while(scanf("%d", &N), N){
        for(int i=4;i<N+4;i++){
            double x1, y1, x2, y2;
            scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

            line[i][0].real(x1);
            line[i][0].imag(y1);
            line[i][1].real(x2);
            line[i][1].imag(y2);
        }

        std::vector<P> v{{-100, -100}, {-100, 100}, {100, 100}, {100, -100}};
        int res = 1;
        for(int i=4;i<N+4;i++){
            for(int j=0;j<25252;j++){used[j] = false;}
            
            for(int j=0;j<i;j++){
                if(areIntersectedLines(line[i][0], line[i][1], line[j][0], line[j][1])){
                    P p = intersection(line[i][0], line[i][1], line[j][0], line[j][1]);
                    double x = real(p), y = imag(p);
                    if(x < -100.0 - EPS || x > 100.0 + EPS || y < -100.0 - EPS || y > 100.0 + EPS){continue;}

                    bool f = true;
                    for(int k=0;k<v.size();k++){
                        if(std::abs(dist(p-v[k])) < 1e-10){
                            if(!used[k]){used[k] = true; res++;}
                            f = false;
                            break;
                        }
                    }
                    if(f){res++; v.push_back(p);}
                }
            }
            res--;
        }

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

Measured memory_bytes: 1260