Problem description

The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.

The language is that peculiar as it has exactly one variable, called x. Also, there are two operations:

  • Operation ++ increases the value of variable x by 1.
  • Operation -- decreases the value of variable x by 1.

A statement in language Bit++ is a sequence, consisting of exactly one operation and one variable x. The statement is written without spaces, that is, it can only contain characters "+", "-", "X". Executing a statement means applying the operation it contains.

A programme in Bit++ is a sequence of statements, each of them needs to be executed. Executing a programme means executing all the statements it contains.

You're given a programme in language Bit++. The initial value of x is 0. Execute the programme and find its final value (the value of the variable when this programme is executed).

Input

The first line contains a single integer n (1 ≤ n ≤ 150) — the number of statements in the programme.

Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter «X»). Thus, there are no empty statements. The operation and the variable can be written in any order.

Output

Print a single integer — the final value of x.

Examples

Input

1
++X

Output

1

Input

2
X++
--X

Output

0
解题思路:给X初始值为0,通过n个操作,实现加1减1运算,水过!
AC代码:
 #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x=;char q[];
cin>>n;
while(n--){
cin>>q;
if(q[]=='+'||q[]=='+')x++;
else x--;
}
cout<<x<<endl;
return ;
}

随机推荐

  1. Weex框架源码分析(Android)(一)

    一.weexSDK初始化流程 WXSDKEngine.initialize(Application application,InitConfig config); //WXSDKEngine的init ...

  2. Scrapy实战:使用scrapy再再次爬取干货集中营的妹子图片

    需要学习的知识: 1.获取到的json数据如何处理 2.保存到json文件 3.保存到MongoDB数据库 4.下载项目图片(含缩略图) 1.创建项目 scrapy startproject gank ...

  3. Mybatis操作Mysql批量更新的一个坑-&allowMultiQueries=true允许批量更新

    前言            利用Mybatis批量更新或者批量插入,实际上即使Mybatis完美支持你的sql,你也得看看你操作的数据库是否完全支持,而同事,最近就遇到这样的一个坑! 问题 先带大家来 ...

  4. Django——7 常用的查询 常用的模型字段类型 Field的常用参数 表关系的实现

    Django 常用的查询 常用的查询方法 常用的查询条件 常用字段映射关系 Field常用参数 表关系的实现 查用的查询方法 这是需要用到的数据 from django.http import Htt ...

  5. noip模拟赛 gcd

    题目更正:输出的a<b. 分析:这是一道数学题,范围这么大肯定是有规律的,打个表可以发现f(a,b)=k,a+b最小的a,b是斐波那契数列的第k+1项和k+2项.矩阵快速幂搞一搞就好了. #in ...

  6. [bzoj3378][Usaco2004 Open]MooFest 狂欢节_树状数组

    MooFest 狂欢节 bzoj-3378 Usaco-2004 Open 题目大意:给定一个n个数的a序列,每两个数之间有一个距离,两个点之间的权值为$max(a[i],a[j])*dis(i,j) ...

  7. code vs 3376 符号三角形

    3376 符号三角形  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题解       题目描述 Description 如下图是由14个“+”和14个“-”组 ...

  8. Oracle-统计数据库表数据总数量

    create or replace procedure prc_table_count(p_flag out varchar2) AS TCOUNT number; SCOUNT number; CO ...

  9. Bran的内核开发指南_中文版

    http://www.cnblogs.com/liloke/archive/2011/12/21/2296004.html 最近在看<orange’s>一书,有点想自己写一个轻量级OS的想 ...

  10. iOS:改变UITableViewCell的选中背景色

    要改变UITableViewCell选中时的背景色,需要在-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtInde ...