#include <stdio.h>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    NSInteger N;
    scanf("%ld", &N);
    NSMutableArray *numbers = [[NSMutableArray alloc] initWithCapacity:N];
    NSMutableArray *mods = [[NSMutableArray alloc] initWithCapacity:N];
    NSInteger i = 0;
    for(i=0;i<N;i++) {
        [numbers addObject:[NSNumber numberWithLong:i+1]];
        [mods addObject:[NSNumber numberWithLong:0]];
    }
    NSInteger j=0;
    for(i=0;i<N;i++){
        for(j=0;j<N;j++) {
            NSNumber *modi = (NSNumber *)([numbers objectAtIndex:i]);
            NSNumber *modj = (NSNumber *)([numbers objectAtIndex:j]);
            NSNumber *current = (NSNumber *)([mods objectAtIndex:i]);
            if (current.longValue < modi.longValue % modj.longValue) {
                NSNumber *value = [NSNumber numberWithLong: (NSInteger)(modi.longValue % modj.longValue)];
                [mods insertObject:value atIndex:j];
                [mods removeObjectAtIndex:j+1];
            }
        }
    }
    
    NSInteger result = 0;
    for(NSNumber *mod in mods) {
        result += mod.longValue;
    }
    printf("%ld", result);
    return 0;
}



