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

int main(int argc, const char * argv[]) {
    int N;
    scanf("%d", &N);
    NSMutableArray *numbers = [[NSMutableArray alloc] initWithCapacity:N];
    NSMutableArray *mods = [[NSMutableArray alloc] initWithCapacity:N];
    int i = 0;
    for(i=0;i<N;i++) {
        [numbers addObject:[NSNumber numberWithInt:i+1]];
        [mods addObject:[NSNumber numberWithInt:0]];
    }
    int 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.integerValue < modi.integerValue % modj.integerValue) {
                NSNumber *value = [NSNumber numberWithInt:modi.integerValue % modj.integerValue];
                [mods insertObject:value atIndex:j];
                [mods removeObjectAtIndex:j+1];
            }
        }
    }
    
    NSInteger result = 0;
    for(NSNumber *mod in mods) {
        result += mod.integerValue;
    }
    printf("%d", result);
    return 0;
}
