//
// Written by Fyodor Menshikov 27.02.2008
// 23:41-23:43
//

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

class Main {

   Scanner in;
   PrintWriter out;

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

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

   void run() {
      int n = in.nextInt();
      asserT(1 <= n && n <= 100);
      out.println(n * (n - 1) / 2);
      out.close();
   }

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