jiahuimbzuai/CoQuIR huggingface dataset:
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	In := ReadLineInt()
	Days := In[0]

	In = ReadLineInt()
	for _, v := range In {
		Days -= v
	}

	if Days <= -1 {
		fmt.Println(-1)
	} else {
		fmt.Println(Days)
	}
}

/////////////////////////////////////////

var BufReader = bufio.NewReaderSize(os.Stdin, 1e6)

func ReadLine() string {
	a, _, _ := BufReader.ReadLine()
	return string(a)
}

func ReadLineInt() (result []int) {
	in := strings.Split(ReadLine(), " ")
	result = make([]int, 0, 2)
	for _, v := range in {
		t, _ := strconv.Atoi(v)
		result = append(result, t)
	}
	return
}

func ReadBigLine() string {
	result := make([]byte, 0, 1e6)
	for {
		line, remains, e := BufReader.ReadLine()
		if e != nil {
			panic(e)
		}
		result = append(result, line...)
		if !remains {
			break
		}
	}
	return string(result)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N, M := nextInt(), nextInt()
	for i := 0; i < M; i++ {
		N -= nextInt()
		if N < 0 {
			fmt.Println(-1)
			return
		}
	}
	fmt.Println(N)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
//  [go]
package main
import ("fmt"
        "strings"
        "bufio"
        "os"
        "strconv"
       )
func main (){
  n,m,an:=0,0,0
  fmt.Scanf("%d %d", &n,&m)
  sc:=bufio.NewScanner(os.Stdin)
  sc.Scan()
  ins:=strings.Split(sc.Text(), " ")
  //in:=[]int
  for _, i := range ins{
    j,_:=strconv.Atoi(i)
    //in=append(in,j)
    an+=j
  }
  if 0>an{
    fmt.Println(-1)
    return
  }
  fmt.Println(n-an)
}
//  [go]
package main
import ("fmt"
        "strings"
        "bufio"
        "os"
        "strconv"
       )
func main (){
  n,m,an:=0,0,0
  fmt.Scanf("%d %d", &n,&m)
  sc:=bufio.NewScanner(os.Stdin)
  sc.Scan()
  ins:=strings.Split(sc.Text(), " ")
  //in:=[]int
  for _, i := range ins{
    j,_:=strconv.Atoi(i)
    //in=append(in,j)
    an+=j
  }
  if 0>an{
    an=-1
  }
  fmt.Println(n-an)
}
//  [go]
package main
import ("fmt"
        "strings"
        "bufio"
        "os"
        "strconv"
       )
func main (){
  n,m,an:=0,0,0
  fmt.Scanf("%d %d", &n,&m)
  sc:=bufio.NewScanner(os.Stdin)
  sc.Scan()
  ins:=strings.Split(sc.Text(), " ")
  //in:=[]int
  for _, i := range ins{
    j,_:=strconv.Atoi(i)
    //in=append(in,j)
    an+=j
  }
  if 0>an{
    an:=-1
  }
  fmt.Println(n-an)
}
//  [ruby]
N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sum
puts A > N ? (-1) : (N - A)
//  [ruby]
n, m = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)

total = as.sum
if total <= n
  puts n - total
else
  puts -1
end
//  [ruby]
n, _m = gets.chomp.split(' ').map(&:to_i)
arr = gets.chomp.split(' ').map(&:to_i)
sum = arr.inject(:+)
puts n >= sum ? n - sum : '-1'
//  [ruby]
n,_,*a=`dd`.split.map &:to_i
p [n-a.sum,0].max
//  [ruby]
input = readlines()

n, m = input.shift.chomp.split("\s").map{|x| x.to_i}

rem = n
input.each do |v|
  rem -= v.chomp.to_i
end

puts rem >= 0 ? rem : '-1'
//  [ruby]
x,y=gets.split.map!(&:to_i)
s=gets.splot.map!(&:to_i)
day=x-s.sum
if day>=0
  puts day
else
  puts -1
end
//  [rust]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use std::collections::*;

fn main() {
    input! {
        n:i32,
        m:usize,
        a:[i32;m],
    }
    let need = a.iter().fold(0, |sum, x| sum + x);
    let ans = if need <= n { n - need } else { -1 };
    println!("{}", ans);
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<u64> = procon_read();
	let n = v[0];
	let m = v[1];
	let mut ai = 0;
	let a:Vec<u64> = procon_read();
	let mut flag = true;
	for i in 0..m {
		ai += a[i as usize];
		if ai > n {
			flag = false;
			break;
		}
	}
	if flag {
		println!("{}", n - ai);
	}else{
		println!("-1");
	}
}
//  [rust]

use proconio::{ input, fastout };

#[fastout]
fn main() {
    input! {
        n: i64,
        m: usize,
        hw: [i64; m],
    };
    let mut sum = 0;
    for i in 0..m {
        sum += hw[i];
    };
    let rest = n - sum ;
    if rest < 0 {
        println!("-1");
    } else {
        println!("{}", rest);
    }


}
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n - 1],
    }
    let mut ans = vec![0; n];

    for i in 0..a.len() {
        ans[a[i] - 1] += 1;
    }

    for i in 0..ans.len() {
        println!("{}", ans[i]);
    }
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: i64,
        m: i64,
        a: [i64; m],
    }
    let mut s = 0;
    for v in a {
        s += v;
    }
    println!("{}", n - s);
}
//  [swift]
protocol InitFromString {
    init?(_ str: String)
}

extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

let nm: [Int] = input()
let n = nm[0]
let m = nm[1]
let am: [Int] = input()

let sum = am.reduce(0, +)
let p = n - sum
print(p < 0 ? -1 : p)
//  [swift]
import Foundation
let main: () = {
    let (N, _) = *listOfInt()
    let A = listOfInt()
    let ans = max(N - A.sum(), -1)
    print(ans)
}()
@inlinable func next() -> String { readLine()! }
@inlinable func nextInt() -> Int { Int(next())! }
@inlinable func nextDouble() -> Double { Double(next())! }
@inlinable func listOfString() -> [String] { next().split(separator: " ").map(String.init) }
@inlinable func listOfInt() -> [Int] { listOfString().map { Int($0)! } }
prefix operator *
prefix func * <T> (a: [T]) -> (T, T) { (a[0], a[1]) }
extension Array where Element == Int {
    @inlinable func sum() -> Element { self.reduce(0, +) }
}
//  [swift]
let n1 = readLine()!.split(separator: " ").map({$0})
    
    let n2 = readLine()!.split(separator: " ").map({$0})
    
    var r: Int = 0
    
    for i in 0 ..< n2.count {
      
      r += Int(n2[i])!
    }
    
    let sum = Int(n1[0])! - r
    
    if sum < 0 {
      print(-1)
    } else {
      print(sum)
    }
//  [swift]
let s = readLine()!.split(separator: " ")
let N = Int(s[0])
let M = Int(s[1])

let t = readLine()!.split(separator: " ").map({Int($0)!})

let work = t.reduce(0, {x,y in x+y})

if N! >= work {
    print(N - work)
} else {
    print(-1)
}
//  [swift]
let s = readLine()!
let t = s.split(separator: " ")
let N = Int(t[0])!
let M = Int(t[1])!
let u = readLine()!

var array:[Int] = []
var sum = 0
for i in 0..<M {
    let v = u.split(separator: " ")
    sum += Int(v[i])!
    
}

if N >= sum {
    print("\(N-sum)")
} else {
    print("-1")
}
//  [swift]
let s = readLine()!
let t = s.split(separator: " ")
let N = Int(t[0])!
let M = Int(t[1])!
let u = readLine()!

var array:[Int] = []
var sum = 0
for i in 0..<M {
    let v = u.split(separator: " ")
    sum += Int(v[i])!
    
}

if N >= sum {
    print(N-sum)
} else {
    print(-1)
}
//  [typescript]
import * as fs from 'fs'

const input = (fs.readFileSync('/dev/stdin', 'utf8') as string).split('\n')
const n = parseInt(input[0].split(' ')[0], 10)
const workDays = input[1]
  .split(' ')
  .map((x: string): number => +x)
  .reduce((acc, x) => (acc += x))

const result = n - workDays > -1 ? n - workDays : -1

console.log(result)
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let N = Number(xs[0].split(' ')[0]);
   let M = Number(xs[0].split(' ')[1]);
   let A = xs[1].trim().split(' ').map(v=>parseInt(v,10));
   let ans = 0;
  
   for(let i=0; i<M; i++){
     ans += A[i] 
   }
   if(N<ans){
     console.log(-1); 
   }else{
     console.log(N-ans);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [typescript]
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const kitaiti = (arr) => {
  let r=0
  for(const a of arr){
    r+=a*(a+1)/2/a
  }
  return r
}
const main = () => {
  const o = new AtCoder()
  let [n, m]=o.nn(2),g=0
  for(let i=0;i<m;i++){
    g+=o.n()
  }
  o.o(g>n?-1:n-g)
}
main();
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N] = input[0].map(Number);
  const A = input[1].map(Number);

  return N - A.reduce((acc, cur) => acc + cur);
};

console.log(main(read()));
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../util'

const output = (x: any) => console.log(x)

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ')
const A = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))

const N = +input[0]
const M = +input[1]



const sum = A.reduce((previousValue, currentValue) => previousValue + currentValue, 0)

N - sum >= 0 ? output(N - sum) : output(-1)
//  [typescript]
import * as fs from 'fs';

// parameter "input" gets all data
function Main(input: string) {
    const lines = input.split('\n');
    const [n, m] = lines[0].split(' ').map(int => parseInt(int));
    const a = lines[1].split(' ').map(int => parseInt(int));

    let sum = 0;
    for (let i = 0; i < m; i++) {
        if(n > sum + a[i]) {
            sum += a[i];
        } else {
            sum = -1;
            break;
        }
    }

    //output
    console.log(n - sum >= 0 ? n - sum : -1);
}

// Don't edit this line!
Main(fs.readFileSync('/dev/stdin', 'utf8'));
//  [python]
n = int(input())

ans = 0
for a in range(1,int(n**(1/2)+1)):
  tmp = 0
  if (a**2) == n:
    break
  elif n%a == 0:
    tmp += ((n//a)-1-a)*2
    tmp += 1
  elif (a * (n//a)) < n:
    tmp += (n//a-a)*2
    tmp += 1
  #print(tmp)
  ans += tmp
print(ans)
//  [python]
n = int(input())
cnt = 0
for i in range(1,n):
  if (n-1)//i < i:
    break
  cnt += (((n-1)//i)-i)*2+1
print(cnt)
//  [python]
N = int(input())

ans = 0
for i in range(1, int((N-1)**(1/2)) + 1):
    ans += 2 * ((N-1)//i - i)
ans += int((N-1)**(1/2))
print(ans)
//  [python]
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,k = inpm()
LR = inplt(k)

s = []
for l,r in LR:
    for i in range(l,r+1):
        s.append(i)
s.sort(reverse=True)
dp = [0.1] + [1] + [0]*(n-1)

# for i in range(2,n+1):
#     for j in s:
#         if i - j < 1:
#             break
#         dp[i] = (dp[i] + dp[i-j]) % 998244353

def f(x):
    if dp[x] != 0:
        return dp[x]
    else:
        ret = sum(map(f,[x-ss for ss in s if ss < x])) % 998244353
        dp[x] = ret
        return ret

print(f(n))
//  [python]
n=int(input())
ar=3
sv=[0]*(10**6+2)
for i in range(2,len(sv)):
	if not sv[i]:
		sv[i]=i
		for j in range(2*i,len(sv),i):
			sv[j]=i
def di(x):
  an=1
  if sv[x]==x:
    return 2
  while x>1:
    ct=0;cr=sv[x]
    while x%cr==0:
      ct+=1;x//=cr
    an*=(ct+1)
  return an
for i in range(4,n+1):
  ar=ar+di(i-1)
print(ar)
//  [python]
n = int(input())
ans =0

for i in range(1,n):
    ans +=(n-1)//a
print(ans)
//  [java]
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		long result = 0;
		for(int i = 1; i < n; i++){
		    result += (n-1)/i;
		}
		
		// 出力
		System.out.println(result);
		
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}

}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();

    int ans = 0;
    for(int i = 1; i < n; i++){
      ans += n / i;
      if(n % i == 0){
        ans--;
      }
    }
    System.out.println(ans);
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}
//  [java]
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;


public class Main {

    public static void main(String[] args) {
    
    	FastScanner scan = new FastScanner();
    	
    	int n = scan.nextInt();
    	int count = 0;
    	
    	for(int i = 1; i<n; i++) {
    		for(int j=1; j<n; j++) {
    			if(i * j < n) count++;
    		}
    	}
    	
    	System.out.println(count);
    	
    }

    static class FastScanner{
    	
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}
    	
    	int nextInt() {
    		return Integer.parseInt(next());
    	}
    	
    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}
    	
    	long nextLong() {
    		return Long.parseLong(next());
    	}
    	
    	
    }
    
   
}
//  [java]
//package atcoder.beginner179;

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

public class Main {
    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args) {
        //initReaderPrinter(true);
        initReaderPrinter(false);
        //solve(in.nextInt());
        solve(1);
    }

    static void solve(int testCnt) {
        for (int testNumber = 0; testNumber < testCnt; testNumber++) {
            int n = in.nextInt();
            int ans = 0;
            for(int c = 1; c < n; c++) {
                int d = n - c;
                int a = 1;
                for(; a * a < d; a++) {
                    if(d % a == 0) {
                        ans += 2;
                    }
                }
                if(a * a == d) {
                    ans += 1;
                }
            }
            out.println(ans);
        }
        out.close();
    }

    static void initReaderPrinter(boolean test) {
        if (test) {
            try {
                in = new InputReader(new FileInputStream("src/input.in"));
                out = new PrintWriter(new FileOutputStream("src/output.out"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            in = new InputReader(System.in);
            out = new PrintWriter(System.out);
        }
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        InputReader(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream), 32768);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        Integer[] nextIntArray(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        Long[] nextLongArray(int n) {
            Long[] a = new Long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    // A x B + C
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        parseAll(N);
//        System.out.println(parseMultiplication(N));
    }

    private static void parseAll(int n) {
        int count = 0;
        for (int i = 1; i < n; i++) {
            int rest = n - i;
            count += parseMultiplication(rest);
        }
        System.out.println(count);
    }

    private static int parseMultiplication(int n) {
        if (n == 1) {
            return 1;
        }
        int count = 0;
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                if (n/i == i) {
                    count++;
                } else {
                    count += 2;
                }
            }
        }
        return count;
    }
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    double n;
    cin >> n;

    int ans = 0;
    for (int i = 1; i < n; i++) {
        if (i * i < n) {
            ans++;
            if (n / i > i) ans += (ceil(n / i) - (i + 1)) * 2;
        } else
            break;
    }

    cout << ans << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Read_ freopen("input.inp", "r", stdin)
#define Write_ freopen("output.out", "w", stdout);
using namespace std;
typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define N  500
int n,a[N][N],sum=0;
int main(){
    _io; 
    cin>>n;
    int x=int(sqrt(n));
    if (x*x==n) --x;
    FOR(i,1,x){

        int y=n/i;
        if (y*i==n) --y;
        sum+=(y-i)*2+1;
    }
    cout<<sum;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main(){
 long long  n;
  cin>>n;
  long long sum=0;
  double m=sqrt(n);
  long long ans=ceil(m);
  for(long long i=1;i<m;i++)
  { long long r=(n-1)/i-(i-1);
   sum+=r;
     }
  cout<<sum*2-ans+1;
  return 0;}
//  [cpp]
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;


int main()
{
    flash;
    ll n,a,b,ab,i,j,cnt=0;
    cin>>n;
    FOR(i,1,n)
    {
        ab = n - i;
        for(j=1;j*j<=ab;j++)
        {
            if(ab%j==0){
                cnt+=2;
            if(j==(ab/j))
                cnt--;
            }
        }
    }
    cout<<cnt<<endl;
}
//  [cpp]
	#include <bits/stdc++.h>

using namespace std;


#define Identify(x) cerr << #x << " is " << x << endl;
#define FOR(i, n) for (int i = 0; i < n; i++)

#define fto(i, s, e) for (int i = (s); i <= (e); ++i)
#define fto1(i, s, e) for (int i = (s); i < (e); ++i)
#define fdto(i, s, e) for (int i = (s); i >= (e); --i)
#define fit(it, a) for (auto it = (a).begin(); it != (a).end(); ++it)
#define fat(i, a) for (auto i : (a))

#define ll long long
#define ii pair<int, int>
#define pll pair<ll, ll>

#define bc __builtin_popcountll
#define y1 hihi
#define endl '\n'
#define x first
#define y second
#define sz(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define buga(a, s, e) cout << '{'; fto (i, s, e) cout << a[i] << " }"[i==e]; cout << endl
#define gn(a) #a << ": " << a << ", " <<

template<class T1, class T2> ostream& operator<<(ostream &os, pair<T1, T2> const &v) {
	return os << '(' << v.ff << ", " << v.ss << ')';
}

template<typename T>
void bug(T const &var) { cout << var << endl; }

//c++ template multi parameters
template<typename Type, typename... Args>
void bug(Type const &var, Args const &... args) {
	cout << var << ' ';
	bug(args...);
}

//global variables
double const pi = acos(-1);
#define oo 1000000007
#define OO 1000000000000000003LL
int const maxn = 1e5+3;

#define multi_test 0
void _main() {
    int n; cin >> n;
	int temp;
	ll cnt = 1 + 2*(n-2); // {1,1,n-1} // fto(i,2,n-1) have {1,i,n-i} {i,1,n-i}
	fto(i,2,n-1){
		temp = oo;
		fto(j,2,i/2){
			if (j >= temp) break;
			if (i % j == 0){
				temp = i/j;
				if (temp != j) cnt += 2;
				else cnt++;
			}
			// cout << gn(cnt) gn(i) gn(temp) gn(j) endl;
		}
	}
	bug(cnt);
}

int main() {
	#ifdef KITTENS
		freopen("main.inp", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t = 1;
	if (multi_test) cin >> t;
	while (t--) {
		_main();
	}

	#ifdef KITTENS
		cerr << 0.001*clock() << endl;
	#endif
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 1000050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\n\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int n;
ll ans;

inline void solve()
{
    cin >> n;
    for (int c = 1; c < n; ++c)
    {
        ll now = n - c;
        int cnt = 0;
        for (int d = 1; d * d < now; ++d)
        {
            if (now % d)
                continue;
            cnt++;
        }
        cnt <<= 1;
        if ((int)sqrt(now) * (int)sqrt(now) == now)
            cnt++;
        ans += cnt;
    }
    cout << ans;
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
    {
        solve();
        // if (Test)
        //     putchar('\n');
    }
    TIME__END = clock();
    program_end();
    return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
int main()
{
    int n;
    int ans = 0;
    int sn;
    scanf("%d", &n);
    sn = (int)sqrt((double)(n - 1));

    for (int i = 1; i <= sn; i++)
    {
        ans += 2 * ((n - 1) / i);
    }
    ans -= sn * (sn - 1);
    ans -= sn;
    printf("%d", ans);
    return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int N,i,cnt=0;
    scanf("%d",&N);

    for(i=1;i<=N-1;i++){
        cnt=cnt+((N-1)/i);
    }

    printf("%d\n",cnt);

    return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 200002

typedef long long ll;

int max(int a,int b){
    if(a>b) return a;
    else return b;
}

int min(int a,int b){
    if(a<b) return a;
    else return b;
}

/*qsort(array,num_of_index,sizeof(int),compare_int); */
 int compare_int(const void *a,const void *b){
     return *(int*) a - *(int *) b; 
 } 
 
int main(){
    int N;
    scanf("%d",&N);
    int ans=0;
    for(int i=1;i<=N-1;i++)
        ans += (N%i == 0 ? N/i - 1:N/i);
    printf("%d",ans);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

#define rep(i, n) for (int i = 0; i < n; i = i + 1)
#define array(N, t) (t*)calloc(N, sizeof(t))
#define ll long long
#define INF ((1LL << 62) - (1LL << 31))
#define max(p, q)((p) > (q) ? (p) : (q))
#define min(p, q)((p) < (q) ? (p) : (q))
#define swap(type, a, b) { type temp = a; a = b; b = temp; }


int N;
int ans = 0;

int baisu_cnt(int x) {
  int cnt = 0;
  for (int i = 1; i <= x; i += 1) {
    if (x % i == 0) {
      cnt += 1;
    }
  }
  return cnt;
}

void solve1() {
  int cnt_C = N - 1;

  for (int i = cnt_C; i > 0; i -= 1) {
    int mult_A_B = N - i;
    int cnt_baisu = baisu_cnt(mult_A_B);
    ans += cnt_baisu;
  }
}

int baisu[1000005] = {0};

void solve2() {
  for (int i = 1; i < N; i += 1) {
    for (int j = 1; j <= i; j += 1) {
      if (i % j == 0) {
        baisu[j] += 1;
      }
    }
  }
  for (int i = 1; i < N; i += 1) {
    ans += baisu[i];
  }
}

void solve3() {
  rep(A, N) {
    ans += (N - 1) / A;
  }
}

int main() {
  scanf("%d", &N);
  // solve1();
  // solve2();
  solve3();
  printf("%d\n", ans);
  return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  long long a,b,c,m,n;
  scanf("%lld", &n);
  long long ans = 0;

  for(c = 1; c <= n-1; c++){
    m = n - c;
    for(a = 1;m/a > 0;a++){
      if(m%a == 0) ans++;
      }
    }
  printf("%lld\n", ans);

  return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  N = parseInt(input[0].split(" "));
  var result = 0;
  for(var i=1; i<N; i++) {
    result += Math.floor((N-1)/i);
  }
  //出力
  console.log("%d", result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}
var streams=[];function print(s){streams.push(s);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));
if(streams.length)console.log(streams.join("\n"));

function main(){
  var n = next();
  var ans = 0;
  for(var i = 1; i < n; i++){
    ans += ((n-1)/i|0);
  }
  return ans;
}
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    let answer = 0;

    for(let i=1; i<N; i++) {
        if(N % i === 0) {
            answer += (N / i) - 1;
        } else {
            answer += Math.floor(N / i);
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  	const total = parseInt(input.split('\n')[0], 10)
    let num = 0
	
	for(let a = total; a > 0; a--) {
		for(let b = total; b > 0; b--) {
          	if(a*b < total) num++
	  	}
	}

	console.log(num)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  	const total = parseInt(input.split('\n')[0], 10)
	let c = 1
    let num = 0
	
    while(c <= total) {
    	const multipleVal = total - c
        c++
      	let b = 1
	    while(b <= multipleVal) {
			let a = 1
	    	while(a * b <= multipleVal) {
    			if(multipleVal === a * b) num++
        		a++
    		}
          b++
    	}
    }
	console.log(num)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")

const lines = input.split('\n')
let N = lines[0].trim() - 0

const fact = (n) => {
    const res = []
    let i = 2
    while (n > 1 && i * i <= n ) {
        if (n % i === 0) {
            res.push(i)
            n /= i
        } else {
            i++
        }
    }
    if (n > 1) {
        res.push(n)
    }
    return res
}

let count = 0

for (let i = 1; i < N - 1; i++) {
    const f = fact(N - i)
    const m = {}
    for (let j = 0; j < f.length; j++) {
        if (m[f[j]]) {
            m[f[j]]++
        } else {
            m[f[j]] = 1
        }
        m[f[j]] = m[f[j]] ? m[f[j]]++ : 1
    }
    let c = 1
    for (var key in m) {
        if (m[key] === 1) {
            c *= 2
        } else {
            c *= m[key] + 1
        }
    }
    count += c
}

console.log(count + 1)
//  [go]
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var N int
  NextInt(&N)
  N--
  cnt := 0
  for k := 1; ; k++ {
    d := N / k
    cnt += d
    if d <= k { break }
    cnt += k * (d - MaxInt(k + 1, N / (k + 1)))
  }
  Write(cnt)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntSlice(A *[]int) {
  L := strings.Split(NextLine(), " ")
  if len(L) == 1 && L[0] == "" {
    (*A) = make([]int, 0)
    return
  }
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatSlice(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  if len(L) == 1 && L[0] == "" {
    (*A) = make([]float64, 0)
    return
  }
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(S ...interface{}) {
  fmt.Fprintln(writer, S...)
}
func WriteIntSlice(A []int) {
  B := make([]interface{}, len(A))
  for i, a := range A { B[i] = a }
  fmt.Fprintln(writer, B...)
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}
//  [go]
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)
	var count = 0
	for A := 1; A <= N; A++ {
		count+= (N-1)/A
	}
	fmt.Println(count)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)
	ans := 0
	for i := 1; i <= N; i++ {
		ans += (N - 1) / i
	}
	fmt.Println(ans)
}
//  [go]

import (
	"bufio"
	"fmt"
	"os"
)

func process(max int) (ret int) {
	count := 0
	for a := 1; a < max; a++ {
		count += (max - 1) / a
	}
	return count
}

func scanNum() (n int) {
	fmt.Scanf("%d\n", &n)
	return
}

func scanStrings(n int) []string {
	sc := bufio.NewScanner(os.Stdin)

	ret := make([]string, n)
	for i := 0; i < n; i++ {
		if sc.Scan() {
			ret[i] = sc.Text()
		}
	}
	return ret
}

func main() {

	ret := process(scanNum())
	fmt.Println(ret)
}
//  [ruby]
N = gets.to_i

n,a,b = 0,1,N
while a < b
	n += 2*(b-a)+1
	n -= 2 if a*b == N
	a += 1
	b = N/a
end
n += 1 if a == b and a*b < N
p n
//  [ruby]
N = gets.chomp.to_i

require 'complex'
root = Math.sqrt(N-1).floor
ans = 0

if N == 2
  puts 1
  exit
end

(1..root).each do |i|
  ans += ((N-1) / i)
  if N / i != i
    ans +=( ((N-1)/i) - ((N-1)/(i+1)))*i
  end
end

puts ans
//  [ruby]
n = gets.to_i

ans = 0
for i in 1..((n-1)**0.5).to_i
  #puts "#{i} : #{((n-1)/i - i) * 2}"
  ans += ((n-1)/i - i+1) * 2
  ans -= 1 if i*i <= n-1
end
puts ans
//  [ruby]
n = gets.chomp.to_i
i = 0
c = 1
ans = 0
while c < n
  nc = n.clone
  nc -= c
  a = 1
  while a <= nc
    b = nc.to_f/a
    # p "a:#{a} b:#{b} c:#{c}"
    if b == b.to_i
      ans += 1
    end
    a += 1
  end
  # p c
  c += 1
end
p ans
//  [ruby]
n = gets.chomp.to_i
i = 0
c = 1
ans = 0
while c < n
  nc = n.clone
  nc -= c
  a = 1
  while a <= nc
    b = nc.to_f/a
    # p "a:#{a} b:#{b} c:#{c}"
    if b == b.to_i
      ans += 1
    end
    a += 1
  end
  p c
  c += 1
end
p ans
//  [ruby]
n=gets.to_i
ans=0
for i in 1...n
  kai=n-i
  for j in 1..(Math.sqrt(kai)).to_i
    ans+= kai%j!=0 ? 0: kai/j!=j ? 2:1
  end
end
puts ans
//  [rust]
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: i64,
    }
    if n == 2 {
        println!("1");
        return;
    }
    let mut ans = 0;
    for i in 1..n - 1 {
        if i * i >= n {
            break;
        }
        let mut ok = i;
        let mut ng = n;
        while (ok - ng).abs() > 1 {
            let mid = (ok + ng) / 2;
            if i * mid < n {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ans += (ok - i) * 2 + 1;
        //println!("{}", ok - i);
    }
    println!("{}", ans);
}
//  [rust]
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::{i32, i64, i128, u32, u64, u128, f64};
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!(
        n: i32,
    );
    let mut ans = 0;
    for a in 1..=n {
        ans += {
            if n % a == 0 { n / a - 1 }
            else { n / a }
        };
    }
    println!("{}", ans);
}
//  [rust]
fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    let n: i64 = rd.get();
    let mut ans = 0;
    for c in 1..=n {
        let m = n - c;
        for a in 1..=m {
            if a * a > m {
                break;
            }
            if m % a == 0 {
                ans += 1;
                if a * a < m {
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}

pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}
//  [rust]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main () {
    input!{
        n: u64,
    }
    let mut num = 0;
    for i in 1..n {

        num += factor(i);
    }
    println!("{:}", num);
}

fn factor(num: u64) -> u64{
    let mut n = num;
    let mut res = 1;
    let mut dev = 2;
    loop {
        if n == 1 { break;}
        let mut count = 0;
        loop {
            if n % dev == 0 {
                n /= dev;
                count += 1;
            }else {
                res *= count + 1;
                break;
            }

            if dev as f64 >= (n as f64).sqrt() {
                res *= 2;
                break;
            }
        }
        dev += 1;
    }
    return res;
}
//  [swift]
func main() {
    let n = Int(readLine()!)!
    
    var counter = 0
    for a in 1..<n {
        for b in 1... {
            if a * b < n {
                counter += 1
            } else {
                break
            }
        }
    }
    print(counter)
}

main()
//  [swift]
let n = Int(readLine()!)!

var ans = 0

for i in 1...n {
  ans += (n - 1) / i
}

print(ans)
//  [swift]
let ab = Int(readLine()!)! - 1
var c = 0
for a in 1...ab{
  c += ab/a
}
print(c)
//  [swift]
import Foundation

func main() {
 var n = Int(readLine()!)!
 var res = 1
 
 if (n == 2) {
   print(res)
 } 
 
 var i = 1
 for i in 2...n-1 {
  var dic: [Int:Int] = [:]	
  var j = 2
  var k = i
  while k >= j {
    if (k%j == 0) {
     if let before = dic[j] {
       dic.updateValue(before + 1, forKey: j)
     } else {
       dic[j] = 1
     }
     k = k / j
    } else {
     j += 1
    }
  }
   var temp = 1
   for (k, v) in dic {
    temp = temp * (v+1)
   }
   res += temp
 }

 print(res)
}

main()
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let n;
    let ans;
    // init
    n = Number(input.shift());
    // solve
    ans = 0;
    for (var nx = 1; nx < n; nx++) {
        ans += Math.floor((n - 1) / nx);
    }
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [python]
n=int(input())
ans=(n-1)*n//2
print(ans)
//  [python]
N=int(input())
print((N*(N-1)//2))
//  [python]
n = int(input())
print(n * (n-1) // 2)
//  [python]
N = int(input())
print(int(N * (N-1) /2))
//  [python]
n = int(input())
print(int(n*(n-1)/2))
//  [java]
import java.util.*;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		long N = Long.parseLong(in.readLine());

		long result = 0;
		if (N == 1) {
			result = 0;
		} else if (N == 2) {
			result = 1;
		} else {
			result = (1 + N - 1) * (N - 1) / 2;
		}
		System.out.println(result);

	}

}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long n = Long.parseLong(br.readLine());

		System.out.println((n - 1) * n / 2);
	}
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int res;

        res = N*(N-1)/2;

        
        
        System.out.println(res);
        
        }
    }
//  [java]
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        System.out.println(n * (n - 1)/ 2);
    }

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