//pikuskd_32->42
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define fr(i,s,e) for(ll i=s;i<=e;i++)
#define rfo(i,s,e) for(ll i=s;i>=e;i--)
#define f(x,m) for(auto x : m)
#define ff first
#define ss second
const ll INF = (1LL << 60) - 1;
#define pb push_back
#define pp pop_back
#define pf push_front
#define ppf pop_front
#define m_p make_pair
#define mod 1000000007
#define TIME cerr<<"Time Taken:"<<(float)clock()/CLOCKS_PER_SEC*1000<<"ms"<<endl
// __builtin_popcount(n)
// cout << fixed << setprecision(2) << a << endl; ->'a' is floating point.

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif

	ll t = 1; //cin>>t;
	while (t--) {
		ll n; cin >> n;
		vector<pair<ll, ll>> v;
		ll x, y;
		fr(i, 0, n - 1) {
			cin >> x >> y; v.pb(m_p(x, y));
		}
		ll c = 0;
		fr(i, 0, n - 1) {
			fr(j, i + 1, n - 1) {
				if (abs(v[j].ss - v[i].ss) <= abs(v[j].ff - v[i].ff)) c++;
			}
		}
		cout << c << endl;
	}
	TIME;
	return 0;
}
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <utility>
#include <queue>
#include <map>
#include <assert.h>
#include <stack>
#include <string>

using namespace std;
int power[31]={0};
string cmp(string s)
{
	string res="";
	for (int j=0; j<s.size(); j++)
	{
		res+='0'+(1-(s[j]-'0'));
	}
	return res;
}

vector<string> f(int x)
{
	if (x==1)
	{
		return {"01"};
	}
	vector<string> p=f(x-1);
	
	vector<string> v;
	string s="";
	for (int j=1; j<=power[x-1]; j++)
	{
		s+='0';
	}
	for (int j=1; j<=power[x-1]; j++)
	{
		s+='1';
	}
	v.push_back(s);
	
	for (int j=0; j<p.size(); j++)
	{
		string r=p[j];
		string f = r + r;
		r+=cmp(p[j]);
		v.push_back(r);
		v.push_back(f);
	}
	return v;
}

void solve()
{
	int n;
	cin>>n;
	
	vector<string> res = f(n);
	
	cout<<(int)res.size()<<"\n";
	for (auto s: res)
	{
		for (auto i : s)
		{
			cout << (char)('A' + (i-'0'));
		}
		cout << "\n";
	}
	return;
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	int t;
	//cin >> t;
	t=1;
	power[0]=1;
	for (int j=1; j<=30; j++) power[j]=power[j-1]*2;
	while (t--)
	{
		solve();
	}
	return 0;
}