#!/usr/bin/perl -w

use v5.16;
use strict;

chomp(my $in = <>);
my $sum;
$sum++ for $in =~ /\(/g;
$sum-- for $in =~ /\)/g;
say $sum;
