#pragma comment(linker, "/stack:32000000")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <functional>
#include <stack>
#include <cstring>
#include <locale>
#include <cstdio>

using namespace std;

#define ll long long
#define ull unsigned ll
#define mp(a,b) (make_pair(a,b))
#define X first
#define Y second
#define INF (int)1e9
#define PR (ll)10000000-3
#define OST (ll)1e9
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double, double>
#define EPS (double)1e-7
#define PI (double)3.1415926535897
#define vi vector<int>
#define vii vector< vi >
#define vl vector<ll>
#define vc vector<char>
#define forn(i, n) for(int i = 0; i < n; ++i)

int n, m, t, k;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

	//string _file_name_ = "sum";
	//freopen((_file_name_ + ".in").c_str(), "r", stdin); freopen((_file_name_ + ".out").c_str(), "w", stdout);
#endif

	ios::sync_with_stdio(false);

	cout << 2000 << endl;
	for (int i = 2; i <= 1000; i+= 2) {
		cout << i << " " << 1 << " " << i << " " << 2 << endl;
		cout << i + 2 << " " << 1 << " " << i + 2 << " " << 2 << endl;
		cout << i << " " << 1 << " " << i << " " << 2 << endl;
		cout << i + 2 << " " << 1 << " " << i  +2 << " " << 2 << endl;
	}

	//cout << endl << clock() / 1000.0;
	return 0;
}


#include<cstdio>

using namespace std;

int main () {
    printf("500\n");
    for ( int i = 0; i < 500; i++ ) {
        printf("%d 1 %d 2\n",i+1,i+1);
        printf("%d 1 %d 2\n",1000-i ,1000-i);
    }
    return 0;
}


#include<cstdio>

using namespace std;

int main () {
    for ( int i = 0; i < 500; i++ ) {
        printf("%d 1 %d 2 ",i+1,i+1);
        printf("%d 1 %d 2\n",1000-i ,1000-i);
    }
    return 0;
}


#include<cstdio>

using namespace std;

int main () {
    puts("2");
    puts("1 1 1 2");
    puts("1000 1 1000 2");
    return 0;
}


#include<cstdio>

using namespace std;

int main () {
    printf("2000\n");
    for ( int i = 2; i <= 1000; i++ ) {
        printf("%d 1 %d 2\n",i, i);
        printf("%d 1 %d 2\n",i-1,i-1);
    }
    return 0;
}


#include<cstdio>

int main () {
    puts("2000");
    for ( int i = 1; i <= 1000; i++ )
        printf("%d 1 %d 2\n", i, i);
    for ( int i = 1000; i >= 1; i-- )
        printf("%d 1 %d 2\n", i, i);
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    cout << 1000 << endl;
    for(int i = 1; i <= 1000; i++){
        cout << i << " "<< 1 << " " << i << " "<< 2 << endl;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    cout << 999 << endl;
    for(int i = 1; i <= 999; i++){
        cout << i << " "<< 1 << " " << i << " "<< 2 << endl;
    }
    return 0;
}


//#pragma comment(linker,"/STACK:100000000000,100000000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#include <fstream>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <list>
#include <sstream>
#include <ctime>
#include <climits>
#include <bitset>
#include <list>
#include <cassert>
#include <complex>

using namespace std;

/* Constants begin */
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2*acos(0.0);
const double E = 2.71828;
/* Constants end */

/* Defines begin */
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define double long double
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define forn(i,n) for (int (i)=0; (i)<(n); ++(i))
#define random (rand()<<16|rand())
#define sqr(x) (x)*(x)
#define base complex<double>
#define sz(a) (int)(a).size()
/* Defines end */

int main(void) {
    #ifdef nobik
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    cout << 2001 << endl;
    for (int i = 1; i <= 1000; ++i) {
		cout << i << " " << 1 << " " << i << " " << 2 << endl;
    }
    cout << 1 << " " << 1 << " " << 1 << " " << 2 << endl;
    for (int i = 1; i <= 1000; ++i) {
		cout << i << " " << 1 << " " << i << " " << 2 << endl;
    }
    return 0;
}


//#pragma comment(linker,"/STACK:100000000000,100000000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#include <fstream>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <list>
#include <sstream>
#include <ctime>
#include <climits>
#include <bitset>
#include <list>
#include <cassert>
#include <complex>

using namespace std;

/* Constants begin */
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2*acos(0.0);
const double E = 2.71828;
/* Constants end */

/* Defines begin */
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define double long double
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define forn(i,n) for (int (i)=0; (i)<(n); ++(i))
#define random (rand()<<16|rand())
#define sqr(x) (x)*(x)
#define base complex<double>
#define sz(a) (int)(a).size()
/* Defines end */

int main(void) {
    #ifdef nobik
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    cout << 2000 << endl;
    for (int i = 1; i <= 999; ++i) {
		cout << i << " " << 1 << " " << i + 1 << " " << 2 << endl;
		cout << i << " " << 2 << " " << i << " " << 2 << endl;
    }
    cout << 1999 << " " << 1 << " " << 1999 << " " << 2 << endl;
    cout << 2000 << " " << 1 << " " << 2000 << " " << 2 << endl;
 	return 0;
}


//#pragma comment(linker,"/STACK:100000000000,100000000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#include <fstream>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <list>
#include <sstream>
#include <ctime>
#include <climits>
#include <bitset>
#include <list>
#include <cassert>
#include <complex>

using namespace std;

/* Constants begin */
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2*acos(0.0);
const double E = 2.71828;
/* Constants end */

/* Defines begin */
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define double long double
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define forn(i,n) for (int (i)=0; (i)<(n); ++(i))
#define random (rand()<<16|rand())
#define sqr(x) (x)*(x)
#define base complex<double>
#define sz(a) (int)(a).size()
/* Defines end */

int main(void) {
    #ifdef nobik
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    cout << 999 * 2 << endl;
    for (int i = 1; i <= 999; ++i) {
		cout << 1 << " " << i << " " << 1 << " " << i + 1 << endl;
		cout << 2 << " " << i << " " << 2 << " " << i + 1 << endl;
    }
 	return 0;
}


//#pragma comment(linker,"/STACK:100000000000,100000000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#include <fstream>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <list>
#include <sstream>
#include <ctime>
#include <climits>
#include <bitset>
#include <list>
#include <cassert>
#include <complex>

using namespace std;

/* Constants begin */
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2*acos(0.0);
const double E = 2.71828;
/* Constants end */

/* Defines begin */
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define double long double
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define forn(i,n) for (int (i)=0; (i)<(n); ++(i))
#define random (rand()<<16|rand())
#define sqr(x) (x)*(x)
#define base complex<double>
#define sz(a) (int)(a).size()
/* Defines end */

int main(void) {
    #ifdef nobik
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    cout << 2000 << endl;
    for (int i = 1; i <= 999; ++i) {
		cout << i << " " << 1 << " " << i + 1 << " " << 1 << endl;
		cout << i << " " << 2 << " " << i + 1 << " " << 2 << endl;
    }
    cout << 1999 << " " << 1 << " " << 2000 << " " << 1 << endl;
    cout << 1999 << " " << 2 << " " << 2000 << " " << 2 << endl;
 	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2000\n";
	cout << "1 1 1 2\n";
	for (int x = 2; x <= 2000; ++x) {
		cout << x - 1 << " 1 " << x - 1 << " 2\n";
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2000\n";
	for (int x = 2; x <= 1000; ++x) {
		cout << x - 1 << " 1 " << x - 1 << " 2\n";
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2001\n";
	for (int x = 1; x <= 1000; ++x) {
		cout << x << " 1 " << x << " 2\n";
	}
	cout << "1000 1 1000 2\n";
	for (int x = 1000; x >= 1; --x) {
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2000\n";
	for (int x = 1; x <= 1000; ++x) {
		cout << x << " 1 " << x << " 2\n";
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2000\n";
	for (int x = 1; x <= 1000; ++x) {
		cout << x << " 1 " << x << " 2\n";
	}
	//cout << "1000 1 1000 2\n";
	for (int x = 1000; x >= 1; --x) {
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2015\n";
	for (int x = 1; x <= 2015; ++x) {
		cout << x << " 1 " << x << " 2\n";
	}
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

#define ALL(x) begin(x), end(x)

typedef long long ll;
typedef unsigned uint;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int main() {
	#ifndef MY
	//freopen("czjanshdzy.in", "r", stdin);
	//freopen("czjanshdzy.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	ios_base::sync_with_stdio(0);

	cout << "2000\n";
	for (int x = 1; x <= 2000; ++x) {
		cout << x << " 1 " << x << " 2\n";
	}
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    cout << 2000 << endl;

    for(int i=1; i<=1000; i++){
        for(int j=1; j<=2; j++)  printf("%d %d ", i, j);
        puts("");
    }
    for(int i=1000; i>=1; i--){
        for(int j=1; j<=2; j++)  printf("%d %d ", i, j);
        puts("");
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    cout << 2000 << endl;
    for(int i=1; i<=2000; i++){
        for(int j=1; j<=2; j++)  printf("%d %d ", i, j);
        puts("");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    cout << 1998 << endl;
    for(int j=1; j<=2; j++) for(int i=1; i<=999; i++) printf("%d %d %d %d\n",i, j, i+1, j);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    cout << 1998 << endl;
    for(int j=1; j<=2; j++) for(int i=1; i<=999; i++) printf("%d %d %d %d\n",j, i, j, i+1);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    cout << 2000 << endl;
    for(int k=1; k<=2; k++)
    for(int i=1; i<=1000; i++){
        for(int j=1; j<=2; j++)  printf("%d %d ", i, j);
        puts("");
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
//#include<quadmath.h>
using namespace std;
vector<pair<int, int> > v;
int main(){
    cout << 2000 << endl;
    for (int i = 1; i <= 1000; i++){
        cout << i << " " << 1 << " " << i << " " << 2 << endl;
    }
    return 0;
}


#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-8;
ll INF = LLONG_MAX / 2;

int main() {
	cout << 2000 << endl;
	for (int i = 1; i <= 1000; i++)
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	for (int i = 1000; i >= 1; i--)
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
//#include<quadmath.h>
using namespace std;
vector<pair<int, int> > v;
int main(){
    cout << 2000 << endl;
    for (int i = 1; i <= 1000; i++){
        cout << i << " " << 1 << " " << i << " " << 2 << endl;
        cout << i << " " << 1 << " " << i << " " << 2 << endl;
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
//#include<quadmath.h>
using namespace std;
vector<pair<int, int> > v;
int main(){
    cout << 1999 << endl;
    int countt = 0;
    for (int i = 1; i <= 1000; i++){
        cout << i << " " << 1 << " " << i << " " << 2 << endl;
        if (i == 1000){
            break;
        }
        cout << i << " " << 1 << " " << i << " " << 2 << endl;
    }
    return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

#define INF 100000000000000000LL

int n, x;
long long l[5001], r[5001];
long long d[10002];

int main() {
	cin >> n >> x;
	vector<long long> v;
	v.push_back(x);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &l[i], &r[i]);
		v.push_back(l[i]);
		v.push_back(r[i]);
	}
	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));
	int m = (int)v.size();
	for (int j = 0; j < m; j++) {
		if (v[j] != x) {
			d[j] = INF;
		} else {
			d[j] = 0LL;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 1; j < m; j++) {
			d[j] = min(d[j], d[j - 1] + v[j] - v[j - 1]);
		}
		for (int j = m - 2; j >= 0; j--) {
			d[j] = min(d[j], d[j + 1] + v[j + 1] - v[j]);
		}
		for (int j = m - 2; j >= 0; j--) {
			d[j] = min(d[j], d[j + 1] + v[j + 1] - v[j]);
		}
		for (int j = 1; j < m; j++) {
			d[j] = min(d[j], d[j - 1] + v[j] - v[j - 1]);
		}
		for (int j = 0; j < m; j++) {
			if (v[j] >= l[i] && v[j] <= r[i]) {
				continue;
			}
			if (v[j] < l[i]) {
				d[j] += l[i] - v[j];
			} else {
				d[j] += v[j] - r[i];
			}
		}
	}
	long long ans = INF;
	for (int i = 0; i < m; i++) {
		ans = min(ans, d[i]);
	}
	cout << ans << endl;
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	cout << 1999 << endl;
	for (int i = 1; i <= 1000; i++) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		if (i > 0) {
			cout << i - 1 << ' ' << 1 << ' ' << i - 1 << ' ' << 2 << endl;
		}
	}
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	cout << 2000 << endl;
	for (int i = 1; i <= 500; i++) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << 1000 - i + 1 << ' ' << 1 << ' ' << 1000 - i + 1 << ' ' << 2 << endl;
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << 1000 - i + 1 << ' ' << 1 << ' ' << 1000 - i + 1 << ' ' << 2 << endl;
	}
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	//freopen("bubble.txt", "w", stdout);
	cout << 1999 << endl;
	cout << 1 << ' ' << 1 << ' ' << 1 << ' ' << 2 << endl;
	for (int i = 2; i <= 1000; i++) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	}
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	cout << 2000 << endl;
	for (int i = 1; i <= 500; i++) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << 1000 - i + 1 << ' ' << 1 << ' ' << 1000 - i + 1 << ' ' << 2 << endl;
		cout << 1000 - i + 1 << ' ' << 1 << ' ' << 1000 - i + 1 << ' ' << 2 << endl;
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	}
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	//freopen("bubble.txt", "w", stdout);
	cout << 2000 << endl;
	for (int i = 1; i <= 1000; i++) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	}
	for (int i = 1000; i >= 1; i--) {
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	}
	return 0;
}


#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>

using namespace std;

int main() {
	//freopen("bubble.txt", "w", stdout);
	cout << 1998 << endl;
	cout << 1 << ' ' << 1 << ' ' << 1 << ' ' << 2 << endl;
	for (int i = 2; i <= 1000; i+= 2) {
		cout << i - 1 << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << i << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
		cout << i + 1 << ' ' << 1 << ' ' << i << ' ' << 2 << endl;
	}
	cout << 1000 << ' ' << 1 << ' ' << 1000 << ' ' << 2 << endl;
	return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 2000 << "\n";
  for(int i = 1; i <= 1000; i++){
    cout << i << " " << 1 << "\n";
    cout << i << " " << 2 << "\n";
  }
   return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 2000 << "\n";
  for(int i = 1; i <= 2000; i++){
    cout << i << " " << 1 << "\n";
    cout << i << " " << 2 << "\n";
  }
   return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 1000 << "\n";
  for(int i = 1; i <= 1000; i++){
    cout << i << " " << 1 << "\n";
    cout << i << " " << 2 << "\n";
  }
   return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 1000 << "\n";
  for(int i = 1; i <= 1000; i++){
    cout << i << " " << 1 << " ";
    cout << i << " " << 2 << "\n";
  }
   return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 2000 << "\n";
  for(int i = 1; i <= 1000; i++){
    cout << i << " " << 1 << " ";
    cout << i << " " << 2 << "\n";
  }

  for (int i = 1000; i > 0; i--) {
      cout << i << " " << 1 << " ";
      cout << i << " " << 2 << "\n";
  }

  return 0;
}


#define TASKNAME ""
#include <bits/stdc++.h>

#define MAXN int(22)
#define MAX  int(200)
#define MOD int(1e9+7)
#define INF int(1e9)
#define pb push_back
#define mp make_pair
#define sz(A) (int)(A).size()
#define pi 3.1415926535897932384626433832795
#define sqr(a) ((a) * (a))
#define x fghsdhgjfshgkjfdhgjfs
#define y jhfjghjfdsghsjfddgdfsgfddfs
#define out(x) cout<<(x)<<" " << "\n"
#define DB(x) cerr<<#x<<" = "<<(x)<<"\n"
#define DB2(a,b)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)

using namespace std;

typedef long long ll;

int main()
{

  #ifndef ONLINE_JUDGE
    freopen(TASKNAME"a.in", "r", stdin);
    freopen(TASKNAME"a.out", "w", stdout);
  #endif
  cout << 1000 << "\n";
  for(int i = 1; i <= 1000; i++){
    cout <<  "500 1 500 2\n";
  }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cout << 2000 << endl;
	for (int j=0; j<2; j++) {
		for (int i=0; i<1000; i++) {
			cout << i+1 << " " << 1 << " " << i+1 << " " << 2 << endl;
		}
	}
	return 0;
}


#include <cstdio>
int main(){
	puts("2000");
	for(int i=1;i<=1000;++i)
		printf("%d 1 %d 2\n",i,i);
	for(int i=1001;i-->1;)
		printf("%d 1 %d 2\n",i,i);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	for (int j=0; j<2; j++) {
		for (int i=0; i<1000; i++) {
			cout << i+1 << " " << 1 << " " << i+1 << " " << 2 << endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	for (int i=0; i<1000; i++) {
		cout << i+1 << " " << 1 << " " << i+1 << " " << 2 << endl;
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define lli long long int
#define pii pair<int,int>
#define mod 1000000007
#define N (int)(2e5+10)
#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define endl '\n'
#define inf mod
#define sag (sol|1)
#define sol (root<<1)
#define ort ((bas+son)>>1)

int main(){
	int i;

	cout << 2000 << endl;

	for(i=1 ; i<=1000 ; i++)
		cout << i << " 1 " << i << " 2" << endl;
}


#include<bits/stdc++.h>

using namespace std;

#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define lli long long int
#define pii pair<int,int>
#define mod 1000000007
#define N (int)(2e5+10)
#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define endl '\n'
#define inf mod
#define sag (sol|1)
#define sol (root<<1)
#define ort ((bas+son)>>1)

int main(){
	int i;

	cout << 1999 << endl;

	for(i=1 ; i<=1000 ; i++)
		cout << i << " 1 " << i << " 2" << endl;
	for(i=2 ; i<=1000 ; i++)
		cout << i << " 1 " << i << " 2" << endl;
}


#include<bits/stdc++.h>

using namespace std;

#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define lli long long int
#define pii pair<int,int>
#define mod 1000000007
#define N (int)(2e5+10)
#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define endl '\n'
#define inf mod
#define sag (sol|1)
#define sol (root<<1)
#define ort ((bas+son)>>1)

int main(){
	int i;

	cout << 2000 << endl;

	for(i=1 ; i<=1000 ; i++)
		cout << i << " 1 " << i << " 2" << endl;
	for(i=1 ; i<=1000 ; i++)
		cout << i << " 1 " << i << " 2" << endl;
}


#include<bits/stdc++.h>

using namespace std;

#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define lli long long int
#define pii pair<int,int>
#define mod 1000000007
#define N (int)(2e5+10)
#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define endl '\n'
#define inf mod
#define sag (sol|1)
#define sol (root<<1)
#define ort ((bas+son)>>1)

int main(){
	int i;

	cout << 2000 << endl;

	for(i=1 ; i<=2000 ; i++)
		cout << i << "  1 " << i << " 2" << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef short int si;
typedef unsigned int ui;

int main(){
	puts("2001");

	for(int i=1;i<=1000;++i){
		printf("%d %d %d %d\n",i,1,i,2);
	}
	puts("1000 1 1000 2");
	for(int i=1000;i>=1;--i){
		printf("%d %d %d %d\n",i,1,i,2);
	}

	return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back

using namespace std;

int main()
{
    int N=1000;
    printf("%i\n",N);
    for(int i=1;i<=N;i++)
    {
        printf("%i %i %i %i\n",i,1,i,2);
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back

using namespace std;

int main()
{
    int N=1000;
    printf("%i\n",2*N);
    for(int i=1;i<=N;i++)
    {
        printf("%i %i %i %i\n",i,1,i,2);
    }
    for(int i=N;i>=1;i--)
    {
        printf("%i %i %i %i\n",i,1,i,2);
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back

using namespace std;

int main()
{
    int N=1000;
    printf("%i\n",2*N);
    for(int i=1;i<=N;i++)
    {
        printf("%i %i %i %i\n",i,1,i,2);
    }
    for(int i=N-1;i>=1;i--)
    {
        printf("%i %i %i %i\n",i,1,i,2);
    }
    return 0;
}


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#define sc_ll(n) scanf("%I64d",&n);
#define pr_ll(n) printf("%I64d\n",n);
#define pr_s(n) printf("%d ",n);
#define pr(n) printf("%d\n",n);
#define sc(n) scanf("%d",&n);
#define forn(i,n) for(i=0;i<n;i++)
#define M 5000100
#define P 100000
#define N 200010
using namespace std;
typedef long long int ll;
//int num[1000005];
//int cand[1000];

int main()
{
    printf("2000\n");
    for(int i=1;i<1001;i++) printf("%d 1 %d 2\n",i,i);
    for(int i=1;i<1001;i++) printf("%d 1 %d 2\n",i,i);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
string fun(string a){
    string b,c=" bokchod";
    b=a+c;
    return b;
}
int main()
{
    string a="arnob";
    a=fun(a);
    cout<<a;
}


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#define sc_ll(n) scanf("%I64d",&n);
#define pr_ll(n) printf("%I64d\n",n);
#define pr_s(n) printf("%d ",n);
#define pr(n) printf("%d\n",n);
#define sc(n) scanf("%d",&n);
#define forn(i,n) for(i=0;i<n;i++)
#define M 5000100
#define P 100000
#define N 200010
using namespace std;
typedef long long int ll;
//int num[1000005];
//int cand[1000];

int main()
{
    printf("2000\n");
    for(int i=1;i<1001;i++) printf("i %d i %d\n",i,i);
    for(int i=1;i<1001;i++) printf("i %d i %d\n",i,i);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
int main()
{
    int i;
    printf("1000");
    for(i=1;i<1000;i++) printf("%d 1 %d 2\n",i,i);
    printf("999 1 999 2");
}


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#define sc_ll(n) scanf("%I64d",&n);
#define pr_ll(n) printf("%I64d\n",n);
#define pr_s(n) printf("%d ",n);
#define pr(n) printf("%d\n",n);
#define sc(n) scanf("%d",&n);
#define forn(i,n) for(i=0;i<n;i++)
#define M 5000100
#define P 100000
#define N 200010
using namespace std;
typedef long long int ll;
//int num[1000005];
//int cand[1000];

int main()
{
    printf("2000\n");
    for(int i=1;i<1001;i++) printf("%d 1 %d 2\n",i,i);
    for(int i=1000;i>=1;i--) printf("%d 1 %d 2\n",i,i);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
int main()
{
    int i;
    printf("1000\n");
    for(i=1;i<1000;i++) printf("%d 1 %d 2\n",i,i);
    printf("999 1 999 2");
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = 0; i < 1000;i++)
    {
        cout << i + 1 << " " << 1 << " " << i + 2 << " " << 2 << endl;
        cout << i + 1 << " " << 2 << " " << i + 2 << " " << 1 << endl;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    ll a = 0;
    for (int i = -2; i < 1000;i++)
    {
        if (i+3<=1000) cout << i + 3 << " " << 1 << " " << i + 3 << " " << 2 << endl,a++;
        if (i+1>0) cout << i + 1 << " " << 1 << " " << i + 1 << " " << 2 << endl,a++;
    }
    cout << a << endl;
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = 0; i < 2000;i++)
        cout << i + 1 << " " << 1 << " " << i + 1 << " " << 2 << endl;
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = 0; i < 1000;i++)
    {
        cout << i + 1 << " " << 1 << " " << i + 2 << " " << 1 << endl;
        cout << i + 1 << " " << 2 << " " << i + 2 << " " << 2 << endl;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2004 << endl;
    ll a = 0;
    for (int i = -2; i < 1000;i++)
    {
        cout << min(i + 3,1000) << " " << 1 << " " << min(i + 3, 1000) << " " << 2 << endl,a++;
        cout << max(i+1,1)  << " " << 1 << " " << max(i + 1, 1) << " " << 2 << endl,a++;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2004 << endl;
    ll a = 0;
    for (int i = -2; i < 1000;i++)
    {
        cout << max(i+1,1)  << " " << 1 << " " << max(i + 1, 1) << " " << 2 << endl,a++;
        cout << min(i + 3, 1000) << " " << 1 << " " << min(i + 3, 1000) << " " << 2 << endl, a++;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    cout << 1000 + 2 << endl;
    ll a = 0;
    cout << 2 << " " << 1 << " " << 2 << " " << 2 << endl, a++;
    cout << 1 << " " << 1 << " " << 1 << " " << 2 << endl, a++;
    for (int i = 0; i < 1000;i++)
    {
        cout <<i+1 << " " << 1 << " " << i+1 << " " << 2 << endl, a++;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = 0; i < 1000;i++)
    {
        cout << i + 1 << " " << 1 << " " << i + 2 << " " << 2 << endl;
        cout << i + 1 << " " << 2 << " " << i + 1 << " " << 1 << endl;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    cout << 2001 << endl;
    ll a = 0;
    for (int i = 0; i < 1000;i++)
    {
        cout << i + 1 << " " << 1 << " " << i + 1 << " " << 2 << endl, a++;
    }
    cout << 1 << " " << 1 << " " << 1 << " " << 2 << endl, a++;
    for (int i = 0; i < 1000;i++)
    {
        cout <<i+1 << " " << 1 << " " << i+1 << " " << 2 << endl, a++;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = 0; i < 999;i++)
    {
        cout << i + 3 << " " << 1 << " " << i + 3 << " " << 1 << endl;
        cout << i + 1 << " " << 2 << " " << i + 1 << " " << 2 << endl;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    ll a = 0;
    for (int i = -2; i < 1000;i++)
    {
        if (i+3<=1000) cout << i + 3 << " " << 1 << " " << i + 3 << " " << 2 << endl,a++;
        if (i+1>0) cout << i + 1 << " " << 1 << " " << i + 1 << " " << 2 << endl,a++;
    }
    pause();
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <stack>
#include <sstream>
#pragma region _Init_
#define X first
#define Y second
#define mp make_pair
#define gch() getchar()
#define er read
#define fi(n) for (int i = 0;i<(n);i++)
#define fid(n) for (int i = (n);i>=0;i--)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define finc(a,b,c) for (int a = b; a < c; a++)
#define fdec(a,b,c) for (int a = b; a >= c; a--)
#define then
#define readln
typedef int ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
void pause()
{
#ifdef _DEBUG
    try {
        system("PAUSE");
    }
    catch (exception ex) {}
#endif
}
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; }
template<class T>const T sqr(const T x) { return x*x; }
ull powi(ull a, ull b) { if (b == 1) return a; return powi(a*a, b / 2)*(b % 2 ? a : 1); }
bool isn(char c) { return ('0' <= c && c <= '9'); }
template<class T> bool read(T &out) { int c = gch(), sign = 1; T num = 0; for (; !isn(c) && c != '-'; c = gch())if (c == EOF)return false; if (c == '-') { sign = -1; c = gch(); }if (c == EOF)return false; for (; isn(c); c = gch())num = num * 10 + c - '0'; out = sign*num; return true; }
#pragma endregion
#define MAGIC_TIME 998

int main() {
    ios::sync_with_stdio(false);
    srand(time(0));
    /*int n; cin >> n;
    vector<string> a(n);
    fi(n) cin >> a[i];*/
    cout << 2000 << endl;
    for (int i = -2; i < 1000;i++)
    {
        if (i+3<=1000)cout << i + 3 << " " << 1 << " " << i + 3 << " " << 1 << endl;
        if (i+1>0)cout << i + 1 << " " << 2 << " " << i + 1 << " " << 2 << endl;
    }
    pause();
    return 0;
}


#include <bits/stdc++.h>

#define printv(i,v) for(int i = 0; i < (int)(v).size(); i++) cout << v[i] << " "; cout << "\n"
#define lp(i,s,n) for(int i = s; i < n; i++)
#define all(v) (v).begin(),(v).end()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define vb vector<bool>
#define vs vector<string>
#define INF int(1e8)
#define NINF int(-1e8)
#define clr(a,v) memset(a,v,sizeof(a))
#define ll long long
#define ld long double

using namespace std;

int n, vis[1234567];

int main()
{
    clr(vis,0);
    cin >> n;
    int a = 0, ans = 0;
    lp(i,0,n){
        char c;
        int p; cin >> c >> p;

        if(c == '+'){
            if(vis[p] != -1 || !vis[p])
                a++;

            vis[p] = 1;
        }
        else{
            if(vis[p] != 1 || !vis[p])
                a++;

            else{
                a--;
            }
            vis[p] = -1;
        }
        ans = max(a,ans);
    }

    cout << ans << "\n";

    return 0;
}


#include <bits/stdc++.h>

#define printv(i,v) for(int i = 0; i < (int)(v).size(); i++) cout << v[i] << " "; cout << "\n"
#define lp(i,s,n) for(int i = s; i < n; i++)
#define all(v) (v).begin(),(v).end()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define vb vector<bool>
#define vs vector<string>
#define INF int(1e8)
#define NINF int(-1e8)
#define clr(a,v) memset(a,v,sizeof(a))
#define ll long long
#define ld long double

using namespace std;

int n, vis[1234567];

int main()
{
    clr(vis,0);
    cin >> n;
    int e = 0, q = 0, ans = 0;
    lp(i,0,n){
        char c;
        int p; cin >> c >> p;
        if(c == '+'){
            if(vis[p] != 1) e++;
            if(vis[p] != -1)
                vis[p] = 1;
        }
        else{
            if(vis[p] != -1) q++;
            if(vis[p] != 1)
                vis[p] = -1;
        }
    }

    cout << max(e,q) << "\n";

    return 0;
}


#include <bits/stdc++.h>

#define printv(i,v) for(int i = 0; i < (int)(v).size(); i++) cout << v[i] << " "; cout << "\n"
#define lp(i,s,n) for(int i = s; i < n; i++)
#define all(v) (v).begin(),(v).end()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define vb vector<bool>
#define vs vector<string>
#define INF int(1e8)
#define NINF int(-1e8)
#define clr(a,v) memset(a,v,sizeof(a))
#define ll long long
#define ld long double

using namespace std;

int n, vis[1234567];

int main()
{
    clr(vis,0);
    cin >> n;
    int e = 0, q = 0, ans = 0;
    lp(i,0,n){
        char c;
        int p; cin >> c >> p;
        if(c == '+'){
            q = 0;
            e++;
        }
        else e = 0, q++;
        ans = max(max(q,e),ans);
    }

    cout << ans << "\n";

    return 0;
}


#include <bits/stdc++.h>

#define printv(i,v) for(int i = 0; i < (int)(v).size(); i++) cout << v[i] << " "; cout << "\n"
#define lp(i,s,n) for(int i = s; i < n; i++)
#define all(v) (v).begin(),(v).end()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define vb vector<bool>
#define vs vector<string>
#define INF int(1e8)
#define NINF int(-1e8)
#define clr(a,v) memset(a,v,sizeof(a))
#define ll long long
#define ld long double

using namespace std;

int n, vis[1234567];

int main()
{
    clr(vis,0);
    cin >> n;
    int tmp = 0, ans = 0;

    lp(i,0,n){
        char c; int p; cin >> c >> p;
        if(c == '-' && vis[p]) tmp--, vis[p] = 0;
        else if(c == '-' && !vis[p]) ans++;
        else if(c == '+') tmp++, vis[p] = 1, ans = max(ans,tmp);
    }

    cout << max(tmp,ans) << "\n";

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        if (i != 0)
            r[i] = r[i - 1];
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j < i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        if (i != 0)
            f[i] = f[i - 1];
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j <= i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    //freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        if (i != 0)
            r[i] = r[i - 1];
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j < i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        if (i != 0)
            r[i] = r[i - 1];
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j <= i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
	r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j < i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        if (i != 0)
            r[i] = r[i - 1];
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j <= i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
            continue;
            //r[i]--;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j <= i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> f(1000000, 0);
    vector <int> r(n, 0);
    for (int i = 0; i < n; i++) {
        char x;
        int y;
        cin >> x >> y;
        if (x == '+') {
            f[y] = 1;
            r[i]++;
            continue;
        }
        if ((x == '-') && (f[y] == 1)) {
            f[y] = 0;
	r[i]--;
            continue;
        }
        if ((x == '-') && (f[y] == 0)) {
            for (int j = 0; j <= i; j++) {
                r[j]++;
                continue;
            }
        }
    }
    cout << *(max_element(r.begin(), r.end()));
}


#include <bits/stdc++.h>
using namespace std;
int arr[1000000]={0};
int main() {
    int n,size,ans,ans1,num;
    char ch;
    cin>>n;
    ans=0;size=0;
    for(int i=0;i<n;i++)
    {
        cin>>ch>>num;
        if(ch=='+')
        {size+=1;
        arr[num]=1;
        }
        else if(ch=='-'&&arr[num]==1)
        {
            ans=max(ans,size);
            size-=1;

        }
        else if(ch=='-'&&arr[num]==0)
        ans+=1;
        ans1=max(ans,size);

    }
    cout<<ans1<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

set<int> s;

int main()
{ char a[3];
    int t,n,i;
    int minm=INT_MIN;
    scanf("%d\n",&t);
    int cnt=0;
    while(t--)
    {
        for(i=0;i<2;i++)
        scanf("%c",&a[i]);
        scanf("%d\n",&n);

    //  cout<<a[0]<<" ";
        if(a[0]=='+')
        s.insert(n);
        else
    {
        if(s.find(n)==s.end())
        s.insert(n);
        else
        s.erase(s.find(n));
        }
        set<int>::iterator it;
//  for(it=s.begin();it!=s.end();it++)
//  cout<<*it<<" ";
//  cout<<endl;
    //  cout<<s.size()<<" ";
        int size=s.size();
        minm=max(minm,size);
    }
    cout<<minm;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

set<int> s;

int main()
{ char a[3];
    int t,n,i;
    int minm=INT_MIN;
    scanf("%d\n",&t);
    int cnt=0;
    char ch[105];

    int j=0,arr[10005];
    int count=t;

while(t--)
    {
        for(i=0;i<2;i++)
        scanf("%c",&a[i]);
        ch[j]=a[0];

        scanf("%d\n",&n);
    arr[j++]=n;
    }

    count=j;
    if(ch[0]=='-')
    {
        s.insert(arr[0]);
        //arr[0]=-1;
    }
    for(i=1;i<count;i++)
    {int flag=0;

        for(j=0;j<i;j++)
    {
        if(ch[i]=='-' && arr[i]==arr[j] )
    {
        flag=1;
         break;
    }
    }
    if(flag==0 && ch[i]=='-')
    {
        s.insert(arr[i]);
//  arr[i]=-1;

    }
    }
//cout<<s.size();
for(i=0;i<count;i++)
    {
            int size=s.size();

        minm=max(minm,size);
        if(ch[i]=='+' )
        s.insert(arr[i]);
        else
        if(ch[i]=='-')
    {

        s.erase(s.find(arr[i]));
        }

    size=s.size();
      minm=max(minm,size);
    }
    cout<<minm;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

set<int> s;

int main()
{ char a[3];
    int t,n,i;
    int minm=INT_MIN;
    scanf("%d\n",&t);
    int cnt=0;
    while(t--)
    {
        for(i=0;i<2;i++)
        scanf("%c",&a[i]);
        scanf("%d\n",&n);

    //  cout<<a[0]<<" ";
        if(a[0]=='+')
        s.insert(n);
        else
    {
        if(s.find(n)==s.end())
    minm++;
        else
        s.erase(s.find(n));
        }
    //  set<int>::iterator it;
//  for(it=s.begin();it!=s.end();it++)
//  cout<<*it<<" ";
//  cout<<endl;
    //  cout<<s.size()<<" ";
        int size=s.size();
        minm=max(minm,size);
    }
    cout<<minm+cnt;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[1000000]={0};
int main() {
    int n,size,ans,ans1,num;
    char ch;
    cin>>n;
    ans=0;size=0;
    for(int i=0;i<n;i++)
    {
        cin>>ch>>num;
        if(ch=='+')
        {size+=1;
        arr[num]=1;
        }
        else if(ch=='-'&&arr[num]==1)
        {
            size-=1;
                ans+=1;
        }
        else if(ch=='-'&&arr[num]==0)
        ans+=1;
        ans1=max(ans,size);

    }
    cout<<ans1<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

set<int> s;

int main()
{ char a[3];
    int t,n,i;
    int minm=INT_MIN;
    scanf("%d\n",&t);
    int cnt=0;
    char ch[105];

    int j=0,arr[10005];
    int count=t;

while(t--)
    {
        for(i=0;i<2;i++)
        scanf("%c",&a[i]);
        ch[j]=a[0];

        scanf("%d\n",&n);
    arr[j++]=n;
    }

    count=j;
    if(ch[0]=='-')
    {
        s.insert(arr[0]);
        //arr[0]=-1;
    }
    for(i=1;i<count;i++)
    {int flag=0;

        for(j=0;j<i;j++)
    {
        if(ch[i]=='-' && arr[i]==arr[j] )
    {
        flag=1;
         break;
    }
    }
    if(flag==0 && ch[i]=='-')
    {
        s.insert(arr[i]);
//  arr[i]=-1;

    }
    }
//cout<<s.size();
for(i=0;i<count;i++)
    {
            int size=s.size();

        minm=max(minm,size);
        if(ch[i]=='+' )
        s.insert(arr[i]);
        else
        if(ch[i]=='-')
    {

        s.erase(s.find(arr[i]));
        }

    }
    cout<<minm;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

set<int> s;

int main()
{ char a[3];
    int t,n,i;
    int minm=INT_MIN;
    scanf("%d\n",&t);
    int cnt=0;
    char ch[105];

    int j=0,arr[10005];
    int count=t;

while(t--)
    { // cout<<"a";
        for(i=0;i<2;i++)
        scanf("%c",&a[i]);
        ch[j]=a[0];
        //cout<<ch[j]<<" ";
        scanf("%d\n",&n);
    arr[j++]=n;
    }
    //cout<<j;
//  cout<<count;
//  for(i=0;i<j;i++)
//  cout<<ch[i]<<" "<<arr[i]<<endl;
    //  cout<<a[0]<<" ";
    count=j;
    if(ch[0]=='-')
    {
        s.insert(arr[0]);
        arr[0]=-1;
    }
    for(i=1;i<count;i++)
    {int flag=0;
//  cout<<ch[i]<<" "<<arr[i]<<endl;
        for(j=0;j<i;j++)
    {
        if(ch[i]=='-' && arr[i]==arr[j] )
    {
        flag=1;
         break;
    }
    }
    if(flag==0 && ch[i]=='-')
    {//cout<<"aaya"<<arr[i]<<" "<<endl;
        s.insert(arr[i]);
        arr[i]=-1;

    }
    }
//  for(i=0;i<count;i++)
//  cout<<ch[i]<<" "<<arr[i]<<endl;
//  cout<<s.size();
for(i=0;i<count;i++)
    {// cout<<s.size();
        if(ch[i]=='+' && arr[i]!=-1)
        s.insert(n);
        else
        if(ch[i]=='-' && arr[i]!=-1)
    {   //cout<<"a";

        s.erase(s.find(n));
        }
    //  set<int>::iterator it;
//  for(it=s.begin();it!=s.end();it++)
//  cout<<*it<<" ";
//  cout<<endl;
    //  cout<<s.size()<<" ";
        int size=s.size();
    //  cout<<size;
        minm=max(minm,size);

    }
    cout<<minm;
    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

char sign[1000000];

int maxLeaveAtOnce(){
    int temp = 0, maxVal = 0;
    char s;

    for(int i = 0; i < 100; i++){
        s = sign[i];
        if( s == '-' ){
            while( sign[i] == '-' ){
                i++;
                temp++;
            }

            if( temp > maxVal )
                maxVal = temp;
        }
    }

    return maxVal;
}

int main( void ){

    int number , currentActive = 0, maxActive = 0, tempID;
    char users[1000000], tempSign;

    cin >> number;

    for( int i = 0; i < number; i++ ){
        cin >> tempSign;
        cin >> tempID;

        if ( tempSign == '+' ){
            currentActive++;
            //cout << "Current Active : " << currentActive << endl;
        } else {
            if( users[tempID] == '+'){
                // he entered after machine active
                currentActive--;
            } else if ( users[tempID] == '-' ){
                if( currentActive + 1 > maxActive )
                    maxActive++;
            }
        }

        if( currentActive > maxActive )
            maxActive = currentActive;

        users[tempID] = tempSign;
        sign[i] = tempSign;
    }

    int maxLeave = maxLeaveAtOnce();

    if( maxLeave > maxActive )
        maxActive = maxLeave;

    cout << maxActive << endl;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

char sign[1000000];

int main( void ){

    int number , currentActive = 0, maxActive = 0, tempID;
    char users[1000000], tempSign;

    cin >> number;

    for( int i = 0; i < number; i++ ){
        cin >> tempSign;
        cin >> tempID;

        if ( tempSign == '+' ){
            currentActive++;
        } else {
            if( users[tempID] == '+'){
                // he entered after machine active
                currentActive--;
            } else {
                maxActive++;
            }
        }

        if( currentActive > maxActive )
            maxActive = currentActive;

        users[tempID] = tempSign;
        sign[i] = tempSign;
    }

    cout << maxActive << endl;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main( void ){

    int number, negetive = 0, positive = 0;
    char sign;

    cin >> number;

    int logs[number];

    for( int i = 0; i < number; i++ ){
        cin >> sign;
        cin >> logs[i];

        if ( sign == '-' ){
            negetive++;
        } else {
            positive++;
        }
    }

    cout << negetive << endl;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

char sign[1000000];

int maxLeaveAtOnce(){
    int temp = 0, maxVal = 0;
    char s;

    for(int i = 0; i < 100; i++){
        s = sign[i];
        if( s == '-' ){
            while( sign[i] == '-' ){
                i++;
                temp++;
            }

            if( temp > maxVal )
                maxVal = temp;
        }
    }

    return maxVal;
}

int main( void ){

    int number , currentActive = 0, maxActive = 0, tempID;
    char users[1000000], tempSign;

    cin >> number;

    for( int i = 0; i < number; i++ ){
        cin >> tempSign;
        cin >> tempID;

        if ( tempSign == '+' ){
            currentActive++;
            //cout << "Current Active : " << currentActive << endl;
        } else {
            if( users[tempID] == '+'){
                // he entered after machine active
                currentActive--;
            } else {
                if( currentActive == maxActive )
                    maxActive++;
            }
        }

        if( currentActive > maxActive )
            maxActive = currentActive;

        users[tempID] = tempSign;
        sign[i] = tempSign;
    }

    int maxLeave = maxLeaveAtOnce();

    if( maxLeave > maxActive )
        maxActive = maxLeave;

    cout << maxActive << endl;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main( void ){

    int number, negetive = 0, positive = 0;

    cin >> number;

    int logs[number];

    for( int i = 0; i < number; i++ ){
        cin >> logs[i];
        if ( logs[i] < 0 ){
            negetive++;
        } else {
            positive++;
        }
    }

    cout << negetive << endl;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main( void ){

    int number, negetive = 0, positive = 0;
    char sign;

    cin >> number;

    int logs[number];

    for( int i = 0; i < number; i++ ){
        cin >> sign;
        cin >> logs[i];

        if ( sign == '-' ){
            negetive++;
        } else {
            positive++;
        }
    }

    if( negetive > positive )
        cout << negetive << endl;
    else
        cout << positive << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;
        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    ans++;
                    b++;
                }
                else
                    b--;
                mp[-1*a]=2;
            }
            //cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a,minas;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;
        minas=0;

        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    ans++;
                }
                else
                {
                    b--;
                    //ans=max(ans,b);
                    mp.erase(mp.find(a*-1));
                }
            }
            //cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;
        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    ans++;
                    mp[-1*a]=2;

                }
                else{
                    b--;

                mp.erase(mp.find(a*-1));
                }
            }
            //cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<iostream>

#include<algorithm>

#include<map>

using namespace std;

int main()
{
    int n;
    map<int,int>m;
    int counter=0,contain=0,t=0,maxi=0;
    cin >> n;
    while(n--)
    {
        string s;

        int r;

        cin >> s >> r;

        if(s=="+")
        {
            if(!m[r])
            {
                //counter++;
                contain++;
                m[r]=1;
                counter=max(counter,contain);
                //cout<<counter<<endl;
            }

        }
        else if(s=="-")
        {
            t=1;
            if(!m[r])
            {
                counter++;

            }
            else if(m[r])
            {
                contain--;
                m.erase(m.find(r));
            }

        }

        //if(maxi<counter)
            maxi = counter;

    }
    cout << maxi << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;

        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                    mp[-1*a]=2;
                }
                else
                {
                    b--;
                    mp.erase(mp.find(a*-1));
                }
            }
            //cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;
        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    ans++;
                }
                else
                    b--;
                mp[-1*a]=2;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,a,minas;
    char ch;
    map<ll,ll>mp;
    while(cin>>n)
    {
        mp.clear();
        ll ans=0;
        ll b=0;
        minas=0;

        for(i=0; i<n; i++)
        {
            cin>>ch;
            cin>>a;
            if(ch=='-')
                a=a*-1;
            if(a>0)
            {
                if(mp.find(a)==mp.end())
                {
                    b++;
                    ans=max(ans,b);
                }
                mp[a]=1;
            }
            else
            {
                if(mp.find(-1*a)==mp.end())
                {
                    ans++;
                }
                else
                {
                    b--;
                    ans=max(ans,b);
                    mp.erase(mp.find(a*-1));
                }
            }
            //cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1000010;
const int inf = 0x7f7f7f7f;
const int mod = 1000000007;
bool vis[N];
int main()
{
    //ios::sync_with_stdio(false);
    int n;
    scanf("%d", &n);
    int ans = 0, cnt = 0;
    int t; char s[2];
    while (n--) {
        scanf("%s %d", &s, &t);
        if (s[0] == '+') {
            if (vis[t] == 0) cnt++;
            vis[t] = 1;
        } else {
            if (vis[t] == 1) {
                vis[t] = 0;
                cnt--;
            } else {
                ans++;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <utility>
using namespace std;
const int maxn = 1e6+7;
const int inf = 0x7f7f7f7f;
const int MOD = 1000000007;
typedef long long ll;
int vis[maxn];
int main()
{
	memset(vis,0,sizeof(vis));
	int n;
	cin >> n;
	char c;
	int num;
	int ret = 0;
	int cost = 0;
	for(int i = 0;i < n;i++) {
		cin >> c >> num;
		if(c == '-') {
			if(vis[num] == 0) {
				ret++;
			}
			else {
				vis[num] = 0;
				cost --;
			}
		}
		else {
			if(cost == ret) {
				ret++;
				cost++;
				vis[num] = 1;
			}
			else {
				cost++;
				vis[num] = 1;
			}
		}
	}
	printf("%d\n",ret);
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<numeric>
#include<vector>
#include<string>
#include<iterator>
#include<cstring>
#include<functional>
#define INF 0x3f3f3f3f
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;

const int maxn = 10000000 + 10;
const int mod = 1e9 + 7;
const double pi = 3.14159265358979;

typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

bool b[maxn];

int main()
{
	int n, ans = 0, now = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		char c;
		int p;
		cin >> c >> p;
		if (c == '+')
		{
			b[p] = 1;
			now++;
		}
		else {
			if (b[p]) b[p] = 0, now--;
			else ans++;
		}
		ans = max(ans, now);
	}
	cout << ans;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
const int maxn=1000010;
const int inf=0xfffffff;
const ll mod=10007;

int n;
int a[maxn];

int main(){

    int n,i,val;
    char c[5];
    while(~scanf("%d",&n)){
        int zheng=0,fu=0;
        memset(a,0,sizeof(a));
        for(i=0;i<n;++i){
            scanf("%s%d",&c,&val);
            if(c[0]=='+'){
                zheng++;
				a[val]++;
            }else{
                if(!a[val]){
                    fu++;
                }else{
					a[val]--;
					zheng--;
				}
            }
            fu=max(fu,zheng);
        }
        printf("%d\n",fu);
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e6 + 10;
int vis[maxn];
int ans[200];
int main()
{
	char a[10];
	int n;
	int num;
	while(~scanf("%d", &n))
	{
		memset(vis, 0, sizeof(vis));
		memset(ans, 0, sizeof(ans));
		int cnt = 0;
		int max1 = -1;
		for(int i = 1; i <= n; i ++)
		{
			scanf("%s", &a);
			scanf("%d", &num);

			if(i > 1)
				ans[i] = ans[i - 1];
			if(a[0] == '+')
			{
				ans[i] ++;
				vis[num] = 1;

			}
			else
			{
				if(i == 1)
				{
					ans[i] ++;
				}
				else
				if(vis[num] == 1)
				{
					vis[num] = 0;
					ans[i] --;
				}
				else
				{
					for(int j = 1; j < i; j ++ )
					{
						ans[j] ++;
					}
				}
			}

		}
		for(int i = 1; i <= n; i ++)
		{
			max1 = max(max1, ans[i]);
		}
		printf("%d\n", max1);

	}
}


#include<stdio.h>
#include<string.h>

const int N = 1000005;
bool vist[N];
int main()
{
    int n,ans;
    char ch[5];
    while(scanf("%d",&n)>0)
    {
        memset(vist,0,sizeof(vist));
        int maxcap=0,num=0;
        while(n--)
        {
            scanf("%s%d",ch,&ans);
            if(ch[0]=='-'){
                if(vist[ans])
                 vist[ans]=0,num--;
                else
                 maxcap++;
            }
            else{
                if(num==maxcap)
                 maxcap++;
                 if(vist[ans]==0)
                  num++;
                vist[ans]=1;

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


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    char crr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        char ch;
        cin>>ch>>x;
        crr[i]=ch;
        brr[i]=x;
        if(ch=='-')
        {

            if(arr[x]==0)
           {
             c++;

           }

        }
        else
        {

            arr[x]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(crr[i]=='+')
        {
            c++;
        }
        else
        {

                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;
    return 0;
}


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        brr[i]=x;
        if(x<0)
        {
            int y=abs(x);
            if(arr[y]==0)
           {
             c++;
             arr[y]=3;
           }
            else
                arr[y]=2;
        }
        else
        {
            int l=abs(x);
            if(arr[l]==0)

            arr[l]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(brr[i]>0)
        {
            c++;
        }
        else
        {

                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;

}


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        brr[i]=x;
        if(x<0)
        {
            int y=abs(x);
            if(arr[y]==0)
           {
             c++;

           }

        }
        else
        {
            int l=abs(x);

            arr[l]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(brr[i]>0)
        {
            c++;
        }
        else
        {

                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;

}


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        brr[i]=x;
        if(x<0)
        {
            int y=abs(x);
            if(arr[y]==0)
           {
             c++;

           }

        }
        else
        {
            int l=abs(x);

            arr[l]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(brr[i]>0)
        {
            c++;
        }
        else
        {

                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;
    return 0;
}


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    char crr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        char ch;
        cin>>ch>>x;
        crr[i]=ch;
        brr[i]=x;
        if(ch=='+')
        {

            if(arr[x]==0)
           {
             c++;

           }

        }
        else
        {

            arr[x]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(crr[i]=='+')
        {
            c++;
        }
        else
        {

                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;
    return 0;
}


#include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
int main()
{

    int n;
    cin>>n;
    vector<int>arr;
    int brr[n];
    for(int i=0;i<1000000;i++)
    arr.push_back(0);

    int c=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        brr[i]=x;
        if(x<0)
        {
            int y=abs(x);
            if(arr[y]==0)
           {
             c++;
             arr[y]=3;
           }
            else
                arr[y]=2;
        }
        else
        {
            int l=abs(x);
            if(arr[l]==0)

            arr[l]=1;

        }
    }
    int mi=c;
    for(int i=0;i<n;i++)
    {
        if(brr[i]>0)
        {
            c++;
        }
        else
        {
            int q=abs(brr[i]);
            if(arr[q]==3)
                c--;
        }
        if(c>mi)
            mi=c;
    }

    cout<<mi;

}


#include<bits/stdc++.h>
using namespace std;
int a[100];
int vis[10000000];
char b[100];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        int flag=0,ans=0,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
                vis[a[i]]=1;
            else if(vis[a[i]]==0)
            {
                q1.insert(a[i]);
            }

        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
            {
                q1.insert(a[i]);
            }
            else
            {
                q1.erase(a[i]);
            }
            if(sum<q1.size())
                sum=q1.size();
        }
        cout<<sum<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[100];
int vis[10000000];
char b[100];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        int flag=0,ans=0,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
                vis[a[i]]=1;
            else if(vis[a[i]]==0)
            {
                q1.insert(a[i]);
            }

        }
        sum=q1.size();
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
            {
                q1.insert(a[i]);
            }
            else
            {
                q1.erase(a[i]);
            }
            if(sum<q1.size())
                sum=q1.size();
        }
        cout<<sum<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int vis[1000000];
char b[1000000];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        set<int >q2;
        int flag=0;
        int ans=0,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n-1;i++)
        {
            if(b[i]!=b[i+1])
            {
                if(ans>sum)
                    sum=ans;
            }
            else ans++;
        }
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[10000000];
int vis[100000000];
char b[10000000];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        int flag=0,ans=0,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
                vis[a[i]]=1;
            else if(vis[a[i]]==0)
            {
                q1.insert(a[i]);
            }

        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
            {
                q1.insert(a[i]);
            }
            else
            {
                q1.erase(a[i]);
            }
            if(sum<q1.size())
                sum=q1.size();
        }
        cout<<sum<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[1000000];
char b[1000000];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        set<int >q2;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
            if(b[i]=='+')
            {
                q1.insert(a[i]);
            }
            else if(b[i]=='-')
            {
                q2.insert(a[i]);
            }
        }
        cout<<max(q1.size(),q2.size())<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int vis[1000000];
char b[1000000];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        int flag=0,ans=0,sum=0;
        memset(vis,0,sizeof(vis));
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(b[i]=='+')
                vis[a[i]]=1;
            else if(vis[a[i]]==0)
            {
                q1.insert(a[i]);
            }
            /*if(vis[a[i]]==0&&b[i]=='+')
            {
                ans++;
                vis[a[i]]=1;
            }
            else if(vis[a[i]]==0&&b[i]=='-')
            {
                vis[a[i]]=1;
                ans++;
            }
            else if(vis[a[i]]==1&&b[i]=='-')
            {
                vis[a[i]]=0;
                ans--;
            }
            else if(vis[a[i]]==1&&b[i]=='+')
            {
                vis[a[i]]=0;
                ans--;
            }
            if(ans>sum)
                sum=ans;
            cout<<ans<<" "<<sum<<endl;*/
        }
        for(int i=0;i<n;i++)
        {
            if(sum<q1.size())
                sum=q1.size();
            if(b[i]=='+')
            {
                q1.insert(a[i]);
            }
            else
            {
                q1.erase(a[i]);
            }
            //cout<<q1.size()<<endl;
            if(sum<q1.size())
                sum=q1.size();
        }
        cout<<sum<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int vis[1000000];
char b[1000000];
int main()
{
    int n;
    while(cin>>n)
    {
        set<int >q1;
        set<int >q2;
        int flag=0;
        int ans=1,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>b[i]>>a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(b[i]!=b[i+1])
            {
                if(ans>sum)
                {
                    //cout<<ans<<endl;
                    sum=ans;
                    ans=1;
                }

            }
            else ans++;
        }
        cout<<sum<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    long int n;
    cin>>n;
    long int a[n],v=0,r=0,f=0,c[n];
    char b[n];
    for(int i=0;i<n;i++)
        cin>>b[i]>>a[i];
    for(int i=0;i<n;i++)
    {
        if(b[i]=='+')
        {
            v++;
            c[f]=a[i];
            f++;
        }
        else if(b[i]=='-')
        {
            for(int j=0;j<f;j++)
            {
                if(a[i]==c[j])
                {
                    v--;
                    r++;
                    break;
                }
                if(j==f-1)
                    v++;
            }
        }
    }
    cout<<v-r;
    return 0;
}