//
// Written by Fyodor Menshikov 28.02.2008
// 0:04-1:11
//

import java.io.*;
import java.util.*;

class Point implements Comparable<Point> {

   double angle;
   int id;

   Point(double angle) {
      this.angle = angle;
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   public int compareTo(Point second) {
      return (int)Math.signum(this.angle - second.angle);
   }
}

class Chord implements Comparable<Chord> {

   Point p1;
   Point p2;

   Chord(Point p1, Point p2) {
      this.p1 = p1;
      this.p2 = p2;
   }

   void normalize() {
      if (p1.id > p2.id) {
         Point t = p1;
         p1 = p2;
         p2 = t;
      }
   }

   public int compareTo(Chord second) {
      return this.p1.id - second.p1.id;
   }
}

class MySet {

   int ge[];

   MySet(int length) {
      ge = new int[length];
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   void add(int value) {
      int left = 0;
      int right = ge.length - 1;
      while (true) {
         asserT(left <= value && value <= right);
         int mid = (left + right) / 2;
         if (value == mid) {
            ge[mid]++;
            break;
         } else if (value < mid) {
            right = mid - 1;
         } else {
            left = mid + 1;
            ge[mid]++;
         }
      }
   }

   int countGE(int value) {
      int left = 0;
      int right = ge.length - 1;
      if (value > right) {
         return 0;
      }
      if (value < left) {
         value = left;
      }
      int count = 0;
      while (true) {
         asserT(left <= value && value <= right);
         int mid = (left + right) / 2;
         if (value == mid) {
            count += ge[mid];
            break;
         } else if (value < mid) {
            count += ge[mid];
            right = mid - 1;
         } else {
            left = mid + 1;
         }
      }
      return count;
   }

   int count(int left, int right) {
      return countGE(left) - countGE(right + 1);
   }
}

class Main {

   StreamTokenizer in;
   PrintWriter out;

   Main() {
      try {
         in = new StreamTokenizer(System.in);
         out = new PrintWriter(System.out);
      } catch (Exception e) {
         throw new Error();
      }
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   double nextDouble() {
      try {
         in.nextToken();
         asserT(in.ttype == in.TT_NUMBER);
         return in.nval;
      } catch (IOException e) {
         throw new Error();
      }
   }

   void run() {
      Chord chords[] = new Chord[(int)nextDouble()];
      if (chords.length == 0) {
         out.println("1");
         out.close();
         return;
      }
      if (chords.length == 1) {
         out.println("2");
         out.close();
         return;
      }
      Point points[] = new Point[chords.length * 2];
      asserT(chords.length >= 2);
      for (int i = 0; i < chords.length; i++) {
         points[i * 2 + 0] = new Point(nextDouble());
         points[i * 2 + 1] = new Point(nextDouble());
         chords[i] = new Chord(points[i * 2 + 0], points[i * 2 + 1]);
      }
      Arrays.sort(points);
      for (int i = 0; i < points.length; i++) {
         points[i].id = i;
      }
      for (int i = 0; i < chords.length; i++) {
         chords[i].normalize();
      }
      Arrays.sort(chords);
      MySet set = new MySet(points.length);
      int sum = 0;
      for (int i = 0; i < chords.length; i++) {
         sum += set.count(chords[i].p1.id, chords[i].p2.id);
         set.add(chords[i].p2.id);
      }
      out.println(1 + chords.length + sum);
      out.close();
   }

   public static void main(String args[]) {
      new Main().run();
   }
}